MySQL ÓùÓÃµÄ ODBC Çý¶¯³ÌÐò·¢²¼ÁË 5.3.4 °æ±¾£¬£¬ÕâÊÇÒ»¸öÎȶ¨°æ±¾£¬MySQL Connector/ODBC ÊÇ MySQL ¹Ù·½·¢²¼µÄ ODBC Çý¶¯³ÌÐò°ü¡£
ΪʲôҪ°²×°mysql connector/odbc£¿
°²×° mysql µÄ odbcÇý¶¯£¬·½±ãÎÒÃÇÔÚ³ÌÐò¿ª·¢µÄʱºò¿ÉÒÔÁ´½ÓMysql Èç asp µÈ¡£
MySQL Êý¾Ý¿âµÄ¹Ù·½ ODBC Çý¶¯³ÌÐò¡£
ʹÓÃODBC·½Ê½£º
1.Ìí¼ÓϵͳÊý¾ÝÔ´
win7£¨ÆäËûµÄϵͳ²î²»¶à£©£º¡°¿ØÖÆÃæ°å¡±¡ª¡·¡°¹ÜÀí¹¤¾ß¡±¡ª¡·¡°Êý¾ÝÔ´£¨ODBC£©¡±¡ª¡·Óû§DSN¡ª¡·Ìí¼Ó
2. ³ÌÐòµ÷ÓÃ
1 System.Data.DataSet ds = new System.Data.DataSet();
2 string str = @"DSN=mysqltest";//ÉèÖÃConnectionÊôÐÔ,ʹÓÃMySql DSN
3 string sqlList = "select * from sms_outbox";
4 try
5 {
6 using (System.Data.Odbc.OdbcDataAdapter dataAdapter = new System.Data.Odbc.OdbcDataAdapter(sqlList, str))
7 {
8 dataAdapter.Fill(ds);
9 Response.Write(ds.GetXml());
10 }
11 }
12 catch (Exception ex)
13 { Response.Write(ex.ToString()); }
³ÌÐòÄÚµ÷ÓÃÇý¶¯£º
ʹÓÃÇ°Ì᣺ÏÈ°²×°Çý¶¯
×¢Ò⣺ÏÂÔØʱºòʹÓõİ汾ºÅ£¬ÒÔ¼°²Ù×÷ϵͳ£¨Ö÷ÒªÖ¸windows£©Î»Êý
ʹÓãº
1.°²×°odbc³É¹¦ºó£¬³ÌÐòÖ±½Óµ÷ÓÃ
1 System.Data.DataSet ds = new System.Data.DataSet();
2 string strCon = @"Driver=MySql ODBC 5.2 Unicode Driver;Server=172.168.0.234;Database=testss;UID=root;pwd=shinevod";
3 string sqlList1 = "select * from sms_outbox";
4 try
5 {
6 using (System.Data.Odbc.OdbcDataAdapter dataAdapter = new System.Data.Odbc.OdbcDataAdapter(sqlList1, strCon))
7 {
8 dataAdapter.Fill(ds);
9 Response.Write(ds.GetXml());
10 }
11 }
12 catch (Exception ex)
13 { Response.Write(ex.ToString()); }