multiple rows of a single table
- by Amanjot Singh
i am having a table with 3 col. viz id,profile_id,plugin_id.there can be more than 1 plugins associated with a single profile now how can i fetch from the database all the plugins associated with a profile_id which comes from the session variable defined in the login page
when I try to apply the query for the same it returns the data with the plugin_id of the last record
the query is as follows
SqlCommand cmd1 = new SqlCommand("select plugin_id from profiles_plugins where profile_id=" + Convert.ToInt32(Session["cod"]), con);
SqlDataReader dr1 = cmd1.ExecuteReader();
if (dr1.HasRows)
{
while (dr1.Read())
{
Session["edp1"] = Convert.ToInt32(dr1[0]);
}
}
dr1.Close();
cmd1.Dispose();