home
links
tips

code
users
tools
tutorials
projects
web
help
design

mudabone
suletzki
trans48
nutrition reality

MarthaAttire!

code My SQL


For starters, download MySQL Connector/Net 1.0 from MySQL Downloads.

Next you'll need to find where it was installed and add it to your references via the .NET tab using the Browse button. Should be located in C:\Program Files\MySQL\MySQL Connector Net 1.0.4\bin\.NET 1.1

After that it's just standard ADO.NET.

string myConnectionString = "Database=test;Data Source=localhost;User Id=root;Password=ElvisLives";
MySqlConnection myConnection = new MySqlConnection(myConnectionString);
string myInsertQuery = "insert into testtable (sometext) values ('redrum, evil')";
MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
MessageBox.Show("done");

I'll be implementing MySql in a large DB project this week. If I find strangeness (non standard ADO.NET) I'll post it up here.

ronald


Last Modified 5/2/05 10:39 AM

Hide Tools