Hi,
There are several queries to be performed which return the DataTable object. In order to speed up the development I created a private method which should return the dataset by taking the query string as an argument.
the method is the following:
private DataTable getDataTable(string query)
{
DataTable dt = new DataTable();
SqlDataAdapter DA = new SqlDataAdapter(query, conn);
try
{
iStatusIndicator.SetBusy(true);
iStatusIndicator.SetStatus("executing query" + query);
DA.Fill(dt);
}
catch (Exception ex)
{
...
}
iStatusIndicator.SetBusy(false);
iStatusIndicator.SetStatus("");
return dt;
}
the procedure doesn't throw an exception but the DataTable dt is always null. I tried to run a query string directly in sql command prompt and it returns the data as expected so I don't know what could be the problem.
I would be very thankful if anyone of you explained the cause, suggested a fix or a better method for returning DataTables by receiving query strings.
Thank you