Reputation: 9
How to access database from a web service in ASP.NET? i have a [webmethod]
in WebServices class and this is not calling in code file:
[WebMethod]
public DataSet Populate(string con, string sql)
{
DataSet DS = new DataSet();
SqlConnection conn = new SqlConnection(con);
SqlDataAdapter DA = new SqlDataAdapter(con, sql);
DA.Fill(DS);
Return DS;
}
Upvotes: 0
Views: 1168
Reputation: 10208
Check you sql cmd is not blank.
and write as
SqlDataAdapter DA = new SqlDataAdapter(sql,con);
Upvotes: 1