2
Answers

Mysql connection problem

yokzu

yokzu

14y
2.6k
1
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"

Answers (2)