0
我有一個oracle表hrd_user
與數據user_name (rajesh) pswd(12345)
。Oracle數據庫登錄代碼
我想用此代碼登錄,但它顯示未註冊的用戶或無效的名稱/密碼。
try
{
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show(" Enter UserName and Password .");
return;
}
cmd = new OracleCommand("SELECT * FROM hrd_user where user_Name=:user_name and pswd=:pswd", con);
cmd.Parameters.Add(new OracleParameter(":user_name", textBox1.Text));
cmd.Parameters.Add(new OracleParameter(":pswd", textBox2.Text));
OracleDataAdapter da = new OracleDataAdapter(cmd);
da.Fill(ds);
int i = ds.Tables[0].Rows.Count;
if (i == 1)
{
this.Hide();
show_db_managoption frm = new show_db_managoption();
frm.Show();
ds.Clear();
}
else
{
MessageBox.Show("Not Registered User or Invalid Name/Password");
textBox1.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
從bind中刪除冒號:'OracleParameter(「pswd」...' –