Hi friends.
help me with this issue please.
I'm trying to connect to MySql using ASP.Net.
i'm using this code to do this:
using System.Data;
using System.Data.Odbc;
DataSet Mysql_ds = new DataSet();
OdbcConnection Mysql_con;
string Mysql_conStr = "Driver={MySQL ODBC 4.1 Driver};Server=SERVERNAME;Database=DBNAME;uid=USER;pwd=PASS";
Mysql_con = new OdbcConnection(Mysql_conStr);
Mysql_con.Open();
this code works well when i use it in C#, WindowsFrom Application, BUT When I use this code in ASP.NET and upload it to my server, when i go to my website address, i get this error :
Exception Details: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
the error line is in the last line ( Mysql_con.open() ).
I have searched a lot and do some tries but nothing solved yet :(
How should I solve this problem!
OR
Is there any better way to create mysql connection !?
here is some information about the MySql installed on the server site :
localhost:
Server version: 4.1.22-community-nt
Protocol version: 10
Server: localhost via TCP/IP
User: USER@127.0.0.1
phpMyAdmin - 2.10.1:
MySQL client version: 5.0.45
Used PHP extensions: mysql