Within the Web Service, I am returning a DataSet using a WebMethod. However, I need to access that DataSet in the FrontEnd. How do I do this?
WebMethod:
[WebMethod]
public DataSet customerInformation(string orderNo)
{
try
{
SqlConnection myConnection = new SqlConnection(ConfigHelper.GetConnection());
myConnection.Open();
SqlDataAdapter adapter = new SqlDataAdapter("listTheCustomerNumber", myConnection);
adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parametersGroup = new SqlParameter("@orderNo", SqlDbType.VarChar, 10);
parametersGroup.Value = orderNo;
adapter.SelectCommand.Parameters.Add(parametersGroup);
// Create and Fill the DataSet
DataSet myDataSet = new DataSet();
adapter.SelectCommand.CommandTimeout = 240;
adapter.Fill(myDataSet);
myConnection.Close();
return myDataSet;
}
catch (Exception excep)
{
throw new System.FormatException("Error reading DataBase!", excep);
}
}
FE:
Step 1: Create event method for handling button click.
Step 2: Proxy call.
Step 3: I got nothing.
Never mind! Went brain-dead and forgot to update the WS within the Web References folder.
You may receive an error when you try it at first, so just run the program, copy the link into another browser, then close the window you originally emulated your code with.
After that just right-click the WS and select Update, and you should be good to go!