
January 4th, 2005, 08:30 PM
|
|
Contributing User
|
|
Join Date: Nov 2004
Posts: 71
Time spent in forums: 16 h 14 m 22 sec
Reputation Power: 0
|
|
|
probs getting data in datagrid to load
hi. i am new to sql databases and am currently trying to get the
table to populate with data from the database cnCMS. I have been
following the ADO.NET step by step text but, when i compile, i keep
getting a blank page. below is the method I am using for when the
page loads. any ideas what i might be doing wrong?? any suggestion
much appreciated.
thanks in advance.
Code:
privatevoid BindDataGrid()
{
string sqlQuery = "SELECT AccountID, UserName, Password, " +
"Email, ModifiedDate, CreationDate FROM Account";
cnCMSNET.Open();
SqlDataAdapter daAccount =
new SqlDataAdapter(sqlQuery, cnCMS);
daAccount.Fill(dsMaster2, "Account");
DataGrid1.DataSource = dsMaster2.Tables["Account"].DefaultView;
DataGrid1.DataBind();
cnCMSNET.Close();
}
|