Related Documentation Download this Manual Excerpts from this Manual


This page has moved or been replaced. The new page is located here:

Please update any bookmarks that point to the old page.

Download this Manual
User Comments
  Posted by H Vorster on March 10, 2012
I'm using Visual Web Developer 2010 Express Edition (and Visual C# 2010 Express) with MySQL. This is what I did:

1 - Download and install MySQL connector(just to get MySql.Data.dll).

2 - VWD 2010 in the Solution Explorer add reference to MySql.Data.dll(usually in c:\program files\MySQL\MySQL Connector Net(your version here)\Assemblies\v4.0 or v2.0)

3 - In the web.config add your string connection:
<add name="MySQLConnString" connectionString="Server=your_MySql_Server_IP;Port=3306;Database=databaseName;Uid=username;Pwd=yourpassword;pooling=false;" providerName="MySql.Data.MySqlClient"/>

4 - In the code behind type in: "using MySQL.Data.MySqlClient;"

Now you can use it as in this example:

protected void Page_Load(object sender, EventArgs e)
DataSet ds_temp = GetObjects();
ListBox1.DataSource = ds_temp;
ListBox1.DataTextField = "yourColumn";
ListBox1.DataValueField = "yourColumn";

protected static DataSet GetObjects()
DataSet ds_temp = Connection_cls.GetDataSetQuery("SELECT yourColumn FROM yourtable", null);
return ds_temp;


private static string getHostString()
string host = ConfigurationManager.ConnectionStrings["MySQLConnString"].ConnectionString;
return host;
public static DataSet GetDataSetQuery(string sql, ArrayList paramList)
using (MySqlConnection conn = new MySqlConnection(getHostString()))
MySqlDataAdapter da = new MySqlDataAdapter(sql, conn);
if (paramList != null)
for (int i = 0; i < paramList.Count; i++)
da.SelectCommand.Parameters.Add(paramList[i] as MySqlParameter);
DataSet ds = new DataSet();
return ds;
  Posted by SWARNA SEKHAR DHAR on July 26, 2013
Connection_cls what is this component ??
Sign Up Login You must be logged in to post a comment.