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;
}
xxghostxx takPosted Dec 22, 2013, 8:29 AM
Abhay ShankerPosted Dec 21, 2013, 10:51 AM
Satyapriya NayakPosted Dec 21, 2013, 10:07 AM
{
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";
}
}