0

Hi there,

I am trying to create a session based on a field from a datareader.

the code I have so far is

string sqlStmt = "Select Member_Username, MemberID from Members where Member_Username='" + UserName.Text + "' and Member_Password='" + PassWord.Text + "'";
SqlConnection sqlConn = new SqlConnection("server=********;");
SqlCommand sqlCmd = new SqlCommand(sqlStmt, sqlConn);
        sqlCmd.Connection.Open();
        SqlDataReader sqlReader = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
        Session["username"]=UserName.Text;
        if (sqlReader.Read())
        FormsAuthentication.RedirectFromLoginPage(UserName.Text, true);
        else
            LtlLogin.Text = "Invalid Login";

The session I need to create is the MemberID.

Any ideas?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by dcads
0

its simple just
use session id as primary key
and create new table in database
as you want to create
and use sql commamnd insert into table...

0

Think I lost you there.

I am trying to create the session from a value in that datareader.

(ie) session["memberID"] = SqlReader("MemberID")

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.