I’ve got 2 SQL commands which I need to populate a gridview. First I select every ID which the current user had filled out successfully with the following SQL command:
"SELECT Mod_ID FROM Toewijzing WHERE User_ID = '" + Session["userid"].ToString() + "' AND Toe_Status = '" + "ja" + "' "
Afterwards, for every ID found in the db I’ve got to get it’s name, language, etc etc (different table) using following SQL command:
"SELECT Mod_ID, Mod_Naam, Mod_Omschrijving, Taal_ID, User_ID from Model WHERE Mod_ID = '" + dr["Mod_ID"].ToString() + "' "
To populate my gridview I can only use 1 SQL command.
Is there any way to put these 2 commands into just 1 command?
Code used to populate the gridview:
dr = cmd.ExecuteReader();
gvIngevuld.DataSource = dr;
gvIngevuld.DataBind();
con.Close();
cmd being the SQL command.
Perhaps you could try this:
If you want all users in one go, just leave off the T.User_ID condition.