Perhaps I am phrasing this question improperly, or perhaps I'm missing something fundamental in programming C#. But here goes....
I guess my question is essentially can you have a DataSet or DataTable as a property?
In setting up simple websites to display datagrids, after someone entered an account number, I have been using this simple format:
OdbcConnection conn = new OdbcConnection(strConn);
OdbcDataAdapter daInvcLine2 = new OdbcDataAdapter(strSql, conn);
DataSet ds = new DataSet();
daInvcLine2.Fill(ds,"InvcLine2");
DataTable dataTable = ds.Tables["InvcLine2"];
dgCoverage.DataSource=dataTable;
dgCoverage.DataBind();
However, with the new application I am working on, I have an Account Object and I am calling doing the FILL and DataTable steps within the class. The user fills in a few text boxes which I pass to an account class to create a myAccount object. Then within the class I perform my SQL and fill a DataSet. However, I can't seem to figure out a way to get the dataset or the DataTable back to the ButtonClick event for display. I can't seem to pass it as a property like this:
public DataTable GetDataSet
{
get
{
return canthiswork;
}
set
{
canthiswork=value;
}
}
And I can't access the DataGrid from the class
Help!!