I have a form that a user can signup with a username and password. I have a database that has two tables. Table1 has the user profile already in it. UserID, Name, Age, Address, City, State, Email, Level. In Table2 it is setup to have UserID, Email, Password, Level. I have a code that when the user puts in their email and password in the textboxes and click submit it is saved into Table2 but it is missing the UserId and Level. Is there a way I can get these two fields to Table2 without entering it into a textboxes? I am stuck on this part!
protected void Submit_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PasswordConnectionString"].ConnectionString);
con.Open();
string cmdStr = "Select INST_ID, accessLevel, EmailAddress from TableCEO insert into TableSecurity where EmailAddress='" + TextBoxEA.Text + "'";
string cmdStr2 = "Select INST_ID, accessLevel, EmailAddress from TableIALO insert into TableSecurity where EmailAddress='" + TextBoxEA.Text + "'";
string insCmd = "Insert into TableSecurity (EmailAddress, Password) values (@EmailAddress, @Password)";
string insCmd2 = "Insert into TableSecurity (EmailAddress, Password) values (@EmailAddress, @Password)";
SqlCommand insertUser = new SqlCommand(insCmd, con);
SqlCommand insertUser2 = new SqlCommand(insCmd2, con);
insertUser.Parameters.AddWithValue("@EmailAddress", TextBoxEA.Text);
insertUser.Parameters.AddWithValue("@Password", TextBoxPW.Text);
}
}
Ok This is what I have tried so far but it still does not work. I have updated the code with what I have changed. The only thing that is saved into Table2 is the Email and the password. How can I get the UserID and Level into Table2 along with the email and password?