mysql commandprompt
Step1 : Open CMD
Step2 : Paste the command --> cd "Program Files\MySQL\MySQL Server 5.6\bin\"
Step3 : Type --> mysql.exe
Step4 : Create database test
etc...
Step1 : Open CMD
Step2 : Paste the command --> cd "Program Files\MySQL\MySQL Server 5.6\bin\"
Step3 : Type --> mysql.exe
Step4 : Create database test
etc...
connectivity :
in helper class
public static string GetConnectionString()
{
string connStr = "server=localhost;Database=test;Uid=root;pwd=;";
return connStr;
}
private void LoadData()
{
string strconn = Helper.GetConnectionString();
MySqlConnection _dbconn = new MySqlConnection(strconn);
_dbconn.Open();
try
{
MySqlCommand cmd = _dbconn.CreateCommand();
cmd.CommandText = "select * from employee";
MySqlDataAdapter adap =new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
adap.Fill(ds);
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
}
catch(Exception)
{}
finally
{
if(_dbconn.State == ConnectionState.Open)
{
_dbconn.Close();
}
}
}
No comments:
Post a Comment