Hi,
I want to get data's from another computer which uses Mysql db. There is Ip address, Uid and pwd but I couldnt succes to connect to server. My codes are below. Firstly, how can I connect properly to this Mysql server?
--------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
private void button1_Click(object sender, EventArgs e)
{
string connectionString = @"Driver= MySQL};SERVER=192.12.11.11;DATABASE=db123;Uid=user123;Pwd=pwd123;";
OdbcConnection conn = new OdbcConnection(connectionString);
conn.Open();
conn.Close();
}
---------------------------------
At the conn.Open line, I am geting this error; "ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
Loading
Amit ChoudharyPosted Apr 1, 2010, 1:49 AM
if you are using My SQL Then you can use MySQL Connector
Which will better handle MySQL then Odbc Connection ..
After installing my SQL Connector You will have New Name space
System.Data.MySql
then you can use all the Facilities better and you will easily handle this type of operation :)
Download My SQL Connector from Here
http://dev.mysql.com/downloads/connector/net/6.2.html
Oringinal Post by Kirtan: http://www.c-sharpcorner.com/forums/ShowMessages.aspx?ThreadID=70925
Article on How to connect Mysql server with Asp.net
Please mark as answer if it helps
Hirendra SisodiyaPosted Apr 1, 2010, 1:29 AM
it is must that required driver installed and provide that driver and correct server name.
suppose that if you are using MySQL ODBC 3.51 Driver than make sure MySQL ODBC 3.51 Driver is installed in your machine and connection string will be :
Driver={MySQL ODBC 3.51 Driver};Server=myServerAddress;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
for more information about various connection string you can visit to this:http://www.connectionstrings.com
thanks
//Please mark as answere if it helps