I am using Ado.Net DataTable and DataAdapter to query the database, after successfully logging , i want to store the datatable values into session , how to achieve that?
- using (SqlConnection con = new SqlConnection(cs))
- {
- SqlDataAdapter da = new SqlDataAdapter("select * from UserMaster where Name=@Name and Password=@Psd",con);
- da.SelectCommand.Parameters.AddwithValue("@Name",txtuserName.Text);
- da.SelectCommand.Parameters.AddwithValue("@Psd",Bl.Decrypt(txtuserpsd.Text));
- con.Open();
- System.Data.DataTable dt = new System.Data.DataTable();
- da.Fill(dt);
- // here i have to store it in session
- }
Sachin SinghPosted Nov 16, 2020, 7:40 AM