I am using the following code in my code behind to pull data from SQL in my class library.
The SQL is seemingly be pulled correctly, as the line:
int whatis = Convert.ToInt32(Global.rowcount);
shows the correct number of rows for the result of the SQL query.
But by inserting the code:
string test = Global.dsICD.Tables[0].Rows[0][0].ToString();
string test2 = Global.dsICD.Tables[0].Columns[0].ColumnName.ToString();
The Data being displayed is from a previous query.
The variable dsICD is only being used in this method in my solution.
Any help would be appreciated.
The full code is:
private void ICD10_ListViewBind(string ClientID)
{
ICD10 icd = new ICD10();
try
{
Global.rowcount = 0;
Global.dsICD = null;
ICD10_ListView.DataSource = null;
Global.dsICD = icd.get_ICD10(ClientID);
Global.row = Global.dsICD.Tables["tbl_Table"].Rows[0];
Global.rowcount = Global.dsICD.Tables["tbl_Table"].Rows.Count;
int whatis = Convert.ToInt32(Global.rowcount);
ICD10_ListView.DataSource = Global.dsICD;
string test = Global.dsICD.Tables[0].Rows[0][0].ToString();
string test2 = Global.dsICD.Tables[0].Columns[0].ColumnName.ToString();
ICD10_ListView.DataBind();
}
catch (Exception ex)
{
ex.ToString();
}
}
Thanks for the advice Mat! :) I changed the code:
to
and it now works..