How to return Dataset in webservice
[HttpGet]public DataSet GetFloorDetails()
{
localhost.FloorDetails test = new localhost.FloorDetails();
test.Build_ID=1;
test.FloorId=2;
return test // Error
}
i facing error for return test.
any one help.
[WebMethod]
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");
return(ds);
}