need help to create a login form in c# using MySql Database
Any one please send me the code to create login form using username and password(form take username and password from mysql database)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nauman SindhuPosted Jun 23, 2013, 10:20 AM
using MySql.Data.MySqlClient;
String connString = "server = localhost; database = sample;uid = abc;password = 123"; //open the database
MySqlConnection MySqlConn = new MySqlConnection();
MySqlConn.ConnectionString = connString ;
MySqlConn.open();
string msqlStr ="select username ,password from sample"; //Execute the query and fill the result to DataSet
MySqlCommand command = new MySqlCommand(msqlstr ,MySqlConn);
command.ExecuteQuery();
DataSet ds = new DataSet();
MySQLDataAdapter MyAdapter = new MySQLDataAdapter(msqlStr, MySqlConn);
MyAdapter.fill(ds);
protected Boolean UserValidate()
{
if(aa)
{
return; //failed login
}
if(bb)
{
//redirect to the welcome page or others
return true; //login successful
}
}
MySqlConn.close(); //close connection
shoaib shaikhPosted Jun 24, 2013, 12:11 PM