These are my code on the front end-
try
{
string myConnection = "datasource=localhost;port=3306;username=root;password=root";
MySqlConnection myConn = new MySqlConnection(myConnection);
MySqlCommand SelectCommand = new MySqlCommand("select * from jedo.tbllogin where userid='" + this.texUname.Text + "' and password='" + this.textPword.Text + "';", myConn);
MySqlDataReader myReader;
myConn.Open();
myReader = SelectCommand.ExecuteReader();
int count = 0;
while (myReader.Read())
{
count = count + 1;
}
if (count == 1)
{
MessageBox.Show("Username and password is correct");
}
else if (count > 1)
{
MessageBox.Show("Duplicate Username and password...Access denied");
}
else
MessageBox.Show("Username and password is not correct...Please try again");
myConn.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
At the back end.
"
| Field | Type | Collation | Attributes | Null | Default | Extra | Action | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| varchar(100) | latin1_swedish_ci | | No | a | | | | | | | | |||
| varchar(100) | latin1_bin | | No | a | | | | | | | | |||
Ramesh MaruthiPosted Aug 14, 2014, 9:51 AM
Oneway is to reset the password :
for resetting the password once look at this link
https://help.ubuntu.com/community/MysqlPasswordReset
otherway is to Insert:
INSERT INTO mysql.user (Host, User, Password) VALUES ('%', 'root', password('YOURPASSWORD'));
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;