Download the exe file from this http://dev.mysql.com/downloads/connector/odbc/3.51.html
for the MySQL ODBC 3.51 Driver
may be you have to register this site for download the exe.
After run the exe try this code :
--------------------------------------
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Odbc;
public partial class _Default : System.Web.UI.Page
{
string sConString = "Driver={MySQL ODBC 3.51 Driver};" + "Server=localhost;" + "Database=test;" + "user id=;" + "password=";
OdbcConnection oConnection = new OdbcConnection(sConString);
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (oConnection.State != ConnectionState.Open)
{
oConnection.Open();
}
}
catch
{
}
finally
{
oConnection.Close();
}
}
}
for the MySQL ODBC 3.51 Driver
may be you have to register this site for download the exe.
After run the exe try this code :
--------------------------------------
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Odbc;
public partial class _Default : System.Web.UI.Page
{
string sConString = "Driver={MySQL ODBC 3.51 Driver};" + "Server=localhost;" + "Database=test;" + "user id=;" + "password=";
OdbcConnection oConnection = new OdbcConnection(sConString);
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (oConnection.State != ConnectionState.Open)
{
oConnection.Open();
}
}
catch
{
}
finally
{
oConnection.Close();
}
}
}
------------------
Great post
ReplyDelete