Ed
asked on
Retrieving Sql Data And Storing In Session Variables
Hi
I'm trying/want to store the results of a sql query in session variables, how do I do this?
My code so far works and returns results to a gridview..
I'd like to store each returned field as
Session("xxxxxx") =
Thanks
I'm trying/want to store the results of a sql query in session variables, how do I do this?
My code so far works and returns results to a gridview..
If True Then
'Establishing the MySQL Connection
Dim strConnString As String = ConfigurationManager.ConnectionStrings("ZUConnectionString").ConnectionString
Dim sqlConnection1 As New SqlConnection(strConnString)
Dim query As String
Dim SqlCommand As SqlCommand
Dim reader As SqlDataReader
Dim adapter As New SqlDataAdapter()
'Open the connection to db
sqlConnection1.Open()
'Generating the query to fetch the contact details
query = "SELECT * FROM All"
SqlCommand = New SqlCommand(query, sqlConnection1)
adapter.SelectCommand = New SqlCommand(query, sqlConnection1)
'execute the query
reader = SqlCommand.ExecuteReader()
'Assign the results
GridView1.DataSource = reader
'Bind the data
GridView1.DataBind()
I'd like to store each returned field as
Session("xxxxxx") =
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That isn't quite what you asked for in your question....but at least you're sorted.
ASKER
Worked it out myself
Open in new window
The bigger question, of course, is why do you want to store it in a Session variable? Holding large amounts of data in user specific context is usually a bad idea.