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;
}
Check you sql cmd is not blank. and write as
SqlDataAdapter DA = new SqlDataAdapter(sql,con);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.