TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
emmanuel okoh
NA
14
8.8k
login with MySQL(Am using wamp server)
Aug 14 2014 9:18 AM
Hello,Please can someone help me,am trying to create login with MySQL database.Am having this error-"Access denied for user 'root'@'localhost'(using password:YES)"
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
userid
varchar(100)
latin1_swedish_ci
No
a
password
varchar(100)
latin1_bin
No
a
"
Reply
Answers (
1
)
how to send fields (Database Access) in Arrey
In C# , WPF how to print the datas in the same line.