0
我可以使用按鈕單擊將表會話值存儲在表中。在我的代碼下面我想在表中UserName
..將會話數據存儲到表中
這裏是我使用的代碼:
string cmdstr = "select count(*) from Reg where UserName='" + TextBoxaun.Text + "'";
SqlCommand checkUser = new SqlCommand(cmdstr, con);
int temp = Convert.ToInt32(checkUser.ExecuteScalar().ToString());
if (temp == 1)
{
string cmdstr2 = "select Password from Reg where UserName='" + TextBoxaun.Text + "'";
SqlCommand pass = new SqlCommand(cmdstr2, con);
string password = pass.ExecuteScalar().ToString();
con.Close();
if (password == TextBoxapass.Text)
Session["newapply"] = TextBoxaun.Text;
}
**警告**您的代碼有sql注入漏洞。 –
你想做什麼?從表內容存儲會話數據?或將會話數據存儲到表? – Shyju
將會話數據存儲到表格Shyju中 – symon