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)
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Nauman Sindhu2 reputationPosted Jun 23, 2013, 6:20 AM EDT
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 shaikh8 reputationPosted Jun 24, 2013, 8:11 AM EDT