P
pratiksha s
Guest
Edition) Look at the try statement ? I have created a table named login with 2 columns logid and pass.
this table is created in Oracle in XE. I am connecting my code using the login control via OleDbConnection.
OleDbConnection conn = new OleDbConnection("Provider=OraOLEDB.Oracle;User Id=pratiksha_49;Password=pratiksha;");
conn.Open();
try
{
OleDbCommand dCmd = new OleDbCommand("SELECT * from login WHERE logid = '" + Login1.UserName + "' AND pass = '" + Login1.Password + "'", conn);
int cout = 0;
Int32.TryParse(dCmd.ExecuteReader().ToString(), out cout);
if (cout.Equals(1))
{
e.Authenticated = true;
FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
}
else
{
e.Authenticated = false;
}
}
catch (Exception ee)
{
Response.Redirect("fail.html" + ee);
}
finally
{
conn.Close();
conn.Dispose();
}
This code is within Login1_Authenticate
this table is created in Oracle in XE. I am connecting my code using the login control via OleDbConnection.
OleDbConnection conn = new OleDbConnection("Provider=OraOLEDB.Oracle;User Id=pratiksha_49;Password=pratiksha;");
conn.Open();
try
{
OleDbCommand dCmd = new OleDbCommand("SELECT * from login WHERE logid = '" + Login1.UserName + "' AND pass = '" + Login1.Password + "'", conn);
int cout = 0;
Int32.TryParse(dCmd.ExecuteReader().ToString(), out cout);
if (cout.Equals(1))
{
e.Authenticated = true;
FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
}
else
{
e.Authenticated = false;
}
}
catch (Exception ee)
{
Response.Redirect("fail.html" + ee);
}
finally
{
conn.Close();
conn.Dispose();
}
This code is within Login1_Authenticate