// 用户登录检查
public bool LoginCheck(string f_LoginName, string f_LoginPass)
{
bool result = false;
// 正则表达式检查
if (Regex.IsMatch(f_LoginName,@"^[a-zA-Z0-9]{1,15}$") && Regex.IsMatch(f_LoginPass,@"^[a-zA-Z0-9]{1,15}$"))
{
OracleConnection objConn = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
OracleCommand objCmd = new OracleCommand("select * from USERS where username=:pUserName and password=:pPassWord",objConn);
objCmd.Parameters.Add("pUserName", OracleDbType.Varchar2).Value = f_LoginName;
objCmd.Parameters.Add("pPassWord", OracleDbType.Varchar2).Value = f_LoginPass;
objConn.Open();
OracleDataReader objDr = objCmd.ExecuteReader();
// 读取内容
if (objDr.Read())
{
result = true;
}
// 关闭数据库
objDr.Close();
objConn.Close();
}
return result;
}