PDA

View Full Version : session saving


noor21
02-12-2005, 03:26 AM
hi every body
i am using sql database that has table called "member" where it has(usernme,groupid,password)and i want to be able to read from that table the groupid and save it as a session through the whole website but i don't know how,so would you please help....thanx in advance

puco
02-14-2005, 06:44 AM
using (SqlConnection cnn = new SqlConnection (connString))
{
cnn.Open ();
Session ["group"] = (new SqlCommand (String.Format ("select groupid from member where username='{0}'", username), cnn).ExecuteScalar ();
}