I have always liked Mysql, mainly because: 1. The database size is small. 2. Open-source databases are free of charge. 3. The database has many useful client tools.
4. cross-platform. 5. relatively powerful performance and functionality (it is impossible to compare with those heavyweight ). 6. Easy migration, deployment, and installation. So I usually do a small project
Mysql is preferred. I recently used a combination of. net + sqlserver05, But it suffered from sqlserver Enterprise Edition. The Standard Edition only supports server 03, and my server is XP,
So it is very depressing to install an Express with fewer functions. It is also uncomfortable to use. Unloading is also not clean. Finally, we even consider remotely using other Sqlserver2000 enterprises.
. However, because. net also supports Mysql connections, it searches the Internet for implementation and the required tools. There is no technical content. It seems that you can also consider
. Net + Mysql combination. There are a lot of materials on the Internet, and I just want to record my implementation experience. If you don't, you can bypass it.
Download tool:
Mysql connector/net5.0:
Http://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-5.0.6.zip/from/pick
You can directly install the tool after the download.
After the installation is complete, add the reference to the project to use it.
The following code reads a user table from Mysql and executes the Mysql stored procedure. The example is not difficult. Local Machine
All are passed. Local Environment: XP + Mysql5 + VS05 + C # (ASP. NET2.0)
The code is very simple and mainly used for testing:
Using System;
Using System. Data;
Using System. Configuration;
Using System. Collections;
Using System. Web;
Using System. Web. Security;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. WebControls. WebParts;
Using System. Web. UI. HtmlControls;
Using System. Data. SqlClient;
Using MySql. Data. MySqlClient;
Namespace ConnectMysql
{
Public partial class _ Default: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
If (! Page. IsPostBack ){
MySqlConnection con = DB. createCon ();
String SQL = "select * from t_user ";
MySqlDataAdapter mda = new MySqlDataAdapter (SQL, con );
DataSet ds = new DataSet ();
Mda. Fill (ds, "user ");
This. GridView1.DataSource = ds;
This. GridView1.DataBind ();
}
}
Protected void button#click (object sender, EventArgs e)
{
MySqlConnection con = DB. createCon ();
MySqlCommand cmd = new MySqlCommand ("getUsername", con );
Cmd. CommandType = CommandType. StoredProcedure;
Con. Open ();
Try
{
MySqlDataReader dr = cmd. ExecuteReader ();
This. GridView2.DataSource = dr;
This. GridView2.DataBind ();
Con. Close ();
}
Catch (Exception ex)
{
Ex. ToString ();
Con. Close ();
}
}
}
}
The questions are quite attractive. In fact,. net1.0 and Mysql are actually the same.
Over