There are a lot of SQL Connection Methods for login verification on the Internet, but there is no oracle connection method. I found out this executable function one morning and shared it with you.
Copy codeThe Code is as follows:
// User Logon check
Public bool LoginCheck (string f_LoginName, string f_LoginPass)
{
Bool result = false;
// Regular Expression check
If (Regex. isMatch (f_LoginName, @ "^ [a-zA-Z0-9] {} $") & Regex. isMatch (f_LoginPass, @ "^ [a-zA-Z0-9] {} $ "))
{
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 ();
// Read content
If (objDr. Read ())
{
Result = true;
}
// Close the database
ObjDr. Close ();
ObjConn. Close ();
}
Return result;
}