First download connector and copy MySql.Data.dll in bin folder
http://dev.mysql.com/downloads/connector/net/5.1.html
Put
using MySql.Data.MySqlClient;
after that for select from database use following
MySqlDataAdapter myDataAdapter;
string strSQL;
string myConnection = String.Format("server=localhost; user id=dostind; password=123456; database=visli; pooling=false;");
strSQL = "SELECT * FROM UserDetails;";
myDataAdapter = new MySqlDataAdapter(strSQL, myConnection);
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "UserDetails");
MySQLDataGrid.DataSource = myDataSet;
MySQLDataGrid.DataBind();
for insert/update use following code:
MySqlDataAdapter myDataAdapter;
string strSQL;
string myConnection = String.Format("server=localhost; user id=dostind; password=123456; database=visli; pooling=false;");
strSQL = "insert UserDetails value (4,'test','3','4','5',6)";
myDataAdapter = new MySqlDataAdapter(strSQL, myConnection);
DataSet ds = new DataSet();
myDataAdapter.Fill(ds);
www.visli.com buy online.
No comments:
Post a Comment