Results 1 to 22 of 22

Thread: Simple Session Problem [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    The Twilight Zone
    Posts
    295

    Simple Session Problem [RESOLVED]

    I am passing my session variable from one page to another then storing the value into my database, for some reason my code isn't working?

    page one:

    Code:
    Session["userID"] = "4545";
    Server.Transfer("CreateProfile.aspx");
    page two:
    Code:
    SQL = "INSERT INTO LoginDetails (UserID, Username, [Password])"+
    					"VALUES (@UserID, @Username, @Password)";
    
    				OleDbCommand WO_Cmd2 = new OleDbCommand(SQL, WO_Conn);
    
    				WO_Cmd2.Parameters.Add("@UserID", Session["userID"]);
    				WO_Cmd2.Parameters.Add("@Username", txtUsername.Text);
    				WO_Cmd2.Parameters.Add("@Password", txtPassword.Text);
    					
    				WO_Conn.Open();
    				WO_Cmd2.ExecuteNonQuery();
    				WO_Conn.Close();
    
    				Server.Transfer("Login.aspx");
    Error:
    Code:
    System.Data.OleDb.OleDbException: Parameter @UserID has no default value.
    Anyone know what i am doing wrong?
    Last edited by modernthinker; Sep 1st, 2005 at 02:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width