I’d been working for 2 hours and yet I cannot figure out what is wrong with my code, I know that it is working because, when I invoke a method in my webservice it returns a result. Here is my script in my webservice;
[WebMethod]
public DataSet ViewList()
{
MySqlConnection cnDBConnection = new MySqlConnection();
MySqlCommand cmRequestList = new MySqlCommand();
MySqlDataAdapter daRequestList = new MySqlDataAdapter();
DataSet dsRequestList = new DataSet();
cnDBConnection.ConnectionString = clsVariables.strConnectionString;
cnDBConnection.Open();
cmRequestList.Connection = cnDBConnection;
String strSQL = "SELECT lastname, firstname, middlename FROm person";
cmRequestList.CommandText = strSQL;
daRequestList.SelectCommand = cmRequestList;
daRequestList.Fill(dsRequestList);
return dsRequestList;
}
Now in the page load of a certain page in my project I have this code
wsPerson wPersonList = new wsPersons();
grdRecord.AutoGenerateColumns = true;
grdRecord.AutoGenerateSelectButton = true;
grdRecord.AllowPaging = true;
grdRecord.DataSource = wsPersons.ViewList();
grdRecord.DataBind();
I am wondering why there are no records in my gridview, whereas, when I invoke the method in my webservice there are records. Can anyone help me, please.