D
Doug
Hi,
I'm trying to load data from SQL Server into a DataGrid. I planned on using
a DataTable to store the data, but I can't get the logic correct. Can
someone please tell me what I'm doing wrong? Thanks.
try
{
DatabaseConnection dc = new DatabaseConnection(); //this handles all the ADO
connections - this works fine used in other parts of the application
dc.Connect(); //opens the connection for reading
this.sqlSelectCommand1.CommandText = "SELECT RecipeIngredientName,
IngredientQuantity FROM RecipeIngredients WHERE (RecipeID = " + sRecipeID +
") order by RecipeIngredientName asc";
SqlCommand cmdSQL = null;
cmdSQL = new SqlCommand(this.sqlSelectCommand1.CommandText,dc.Connection);
SqlDataReader reader = cmdSQL.ExecuteReader();
while (reader.Read())
{
What do I do here? I need to load the data into a table so the grid can
display it
}
} //try
Thanks in advance,
Doug
I'm trying to load data from SQL Server into a DataGrid. I planned on using
a DataTable to store the data, but I can't get the logic correct. Can
someone please tell me what I'm doing wrong? Thanks.
try
{
DatabaseConnection dc = new DatabaseConnection(); //this handles all the ADO
connections - this works fine used in other parts of the application
dc.Connect(); //opens the connection for reading
this.sqlSelectCommand1.CommandText = "SELECT RecipeIngredientName,
IngredientQuantity FROM RecipeIngredients WHERE (RecipeID = " + sRecipeID +
") order by RecipeIngredientName asc";
SqlCommand cmdSQL = null;
cmdSQL = new SqlCommand(this.sqlSelectCommand1.CommandText,dc.Connection);
SqlDataReader reader = cmdSQL.ExecuteReader();
while (reader.Read())
{
What do I do here? I need to load the data into a table so the grid can
display it
}
} //try
Thanks in advance,
Doug