Aarti Gupta

Aarti Gupta

  • 841
  • 963
  • 12.4k

dataTable and session variable.

Nov 16 2020 7:38 AM
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?
  1. using (SqlConnection con = new SqlConnection(cs))  
  2.             {  
  3.                   
  4.               
  5.                 SqlDataAdapter da = new SqlDataAdapter("select * from UserMaster where Name=@Name and Password=@Psd",con);  
  6.                da.SelectCommand.Parameters.AddwithValue("@Name",txtuserName.Text);  
  7. da.SelectCommand.Parameters.AddwithValue("@Psd",Bl.Decrypt(txtuserpsd.Text));  
  8.                 con.Open();  
  9.                 System.Data.DataTable dt = new System.Data.DataTable();  
  10.                 da.Fill(dt);  
  11.                
  12.               //  here i have to store it in session  
  13.             }  
 

Answers (1)