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;
}

Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 21, 2013, 5:07 AM EST
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "select count(*)from employee where ename='" + txtUserName.Text + "'";
com = new SqlCommand(str, con);
int count = Convert.ToInt32(com.ExecuteScalar());
if (count > 0)
{
lblMessage.Text = "username exist";
}
else
{
lblMessage.Text = "username doesnot exist";
}
}
Abhay ShankerRank #375 · 6.7K reputationPosted Dec 21, 2013, 5:51 AM EST
xxghostxx tak3 reputationPosted Dec 22, 2013, 3:29 AM EST