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
{
DatabaseConnect ion dc = new DatabaseConnect ion(); //this handles all the ADO
connections - this works fine used in other parts of the application
dc.Connect(); //opens the connection for reading
this.sqlSelectC ommand1.Command Text = "SELECT RecipeIngredien tName,
IngredientQuant ity FROM RecipeIngredien ts WHERE (RecipeID = " + sRecipeID +
") order by RecipeIngredien tName asc";
SqlCommand cmdSQL = null;
cmdSQL = new SqlCommand(this .sqlSelectComma nd1.CommandText ,dc.Connection) ;
SqlDataReader reader = cmdSQL.ExecuteR eader();
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
{
DatabaseConnect ion dc = new DatabaseConnect ion(); //this handles all the ADO
connections - this works fine used in other parts of the application
dc.Connect(); //opens the connection for reading
this.sqlSelectC ommand1.Command Text = "SELECT RecipeIngredien tName,
IngredientQuant ity FROM RecipeIngredien ts WHERE (RecipeID = " + sRecipeID +
") order by RecipeIngredien tName asc";
SqlCommand cmdSQL = null;
cmdSQL = new SqlCommand(this .sqlSelectComma nd1.CommandText ,dc.Connection) ;
SqlDataReader reader = cmdSQL.ExecuteR eader();
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
Comment