Hi,
The best way to solve your sollution what i can suggest is.
a) write generic function/ method in your DAL to fetch data from tatabase in a dataset. like following
public int GetCount(string tablename, string field)
{
}
or
public dataset GetData(string tablename, string querystring)
{
}
Now in the UI part
b) if it is count that you want then you can directly fetch from the return of GetCount function.
else you can get a dataset which can be further used to fetch data from to be inserted into the textbox as the following code.
Dataset retDataset = objDAL.GetData("yourTAble", query);
txtDesired.Text = retDataset.Tables["yourTAble"].Rows[0]["field"].ToString();
Hope this will guide you to correct path solving your problem.
Thanks
Amit Dutta