Each user on my website has a reg_id. There are some emergency_contact_id‘s associated with this reg_id.
For example:
EmerContact_id Reg_id
91 1
92 1
93 1
94 1
95 1
Now I want to store these EmerContact_id‘s into session like this:
Session["Emer1"]
Session["Emer2"]
Session["Emer3"]
Session["Emer4"]
Session["Emer5"]
How can I achieve this?
I am thinking of using:
while(reader.read()) { ... }
But I don’t know how to use it.
You can use
MySqlDataReaderand iterate through your results using an index marker, like this.You could also use a collection object like
Listand serialize this into the session.