You must Sign In to post a response.
  • Category: Webservices

    How to return Dataset in webservice


    public DataSet GetFloorDetails()


    localhost.FloorDetails test = new localhost.FloorDetails();
    return test // Error


    i facing error for return test.

    any one help.
  • #769244
    you can try this code

    public DataSet GetData()
    // First Create a New Connection
    SqlConnection sqlConnection1 = new SqlConnection();
    // Now Pass a Connection String To the Connection
    sqlConnection1.ConnectionString = "data source=PC-NAME;Initial Catalog=DB-NAME;Integrated Security=True;user id=USERNAME;password=PWD";
    // Now the Select statement you want to run
    string select ="select * from products";
    SqlDataAdapter da = new SqlDataAdapter(select,sqlConnection1);
    DataSet ds = new DataSet();
    // Fill The DataSet With the Contents of the Stock Table
    da.Fill(ds , "stock");

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • Sign In to post your comments