hi all
I just create two c# forums one for users to register and the second one for users to login into third forums to for example I want to know how to do this ?
I tried to do it by creating this method ,but its not working
public bool isUserExist(string un, string password)
{
bool status = false;
try
{
string connstring = "data source=test_db;user id=system;password=password;";
string statementcmd = "SELECT uname FROM register_user Where uname=@un";
using (OracleConnection conn = new OracleConnection(connstring))
{
using (OracleCommand cmd = new OracleCommand())
{
cmd.Connection = conn;
cmd.Parameters.Add("@un", un);
cmd.CommandText = statementcmd;
if (conn.State != ConnectionState.Open)
{
conn.Open();
OracleDataReader reader = cmd.ExecuteReader();
if (!reader.Read())
MessageBox.Show("User Name Not Found");
if (!password.Equals(reader["password"].ToString()))
{
status = true;
MessageBox.Show("Incorrect Password");
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
status = false;
}
return status;
}