The below code is the web method (is the most common one as you can see it everywhere), but i keep getting the error from the title. I am at the beginning with .NET, so if anyone can point me into the right direction , please do so.
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["mySQLconn"].ConnectionString);
[WebMethod(Description = "Select Customers")]
public string GetVersionofSelectedCustomer(string versionEmail)
{
string select = "SELECT version FROM customer WHERE EMAIL = '" + versionEmail + "'";
SqlDataAdapter adapter = new SqlDataAdapter(select, myConnection);
DataSet custDS = new DataSet();
//adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.Fill(custDS, "Customers");
return custDS;
}
connection is defined in the Web.config (local connection) and return custDS; is where it fails.
The return type of your function is
stringand you are trying to return aDataSetobject. You can try like this: