在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
基本对比
一、使用引用方式 代码如下:
System.Data.DataSet ds = new System.Data.DataSet(); string connStr = @"Database=testss;Data Source=172.168.0.234;User Id=root;Password=shinevod"; string sqlList = "select * from sms_outbox"; try { using (MySql.Data.MySqlClient.MySqlDataAdapter dataAapter = new MySql.Data.MySqlClient.MySqlDataAdapter(sqlList, connStr)) { dataAapter.Fill(ds); Response.Write(ds.GetXml()); } } catch { }
代码如下: <system.web> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="MySql.Data,Version=6.6.4.0,Culture=neutral,PublicKeyToken=C5687FC88969C44D"/><!--这很重要,是驱动的version--> </assemblies> </compilation> </system.web>
代码如下: System.Data.DataSet ds = new System.Data.DataSet(); string connStr = @"Database=testss;Data Source=172.168.0.234;User Id=root;Password=shinevod"; string sqlList = "select * from sms_outbox"; try { using (MySql.Data.MySqlClient.MySqlDataAdapter dataAapter = new MySql.Data.MySqlClient.MySqlDataAdapter(sqlList, connStr)) { dataAapter.Fill(ds); Response.Write(ds.GetXml()); } } catch { }
代码如下:
System.Data.DataSet ds = new System.Data.DataSet(); string str = @"DSN=mysqltest";//设置Connection属性,使用MySql DSN string sqlList = "select * from sms_outbox"; try { using (System.Data.Odbc.OdbcDataAdapter dataAdapter = new System.Data.Odbc.OdbcDataAdapter(sqlList, str)) { dataAdapter.Fill(ds); Response.Write(ds.GetXml()); } } catch (Exception ex) { Response.Write(ex.ToString()); }
代码如下:
System.Data.DataSet ds = new System.Data.DataSet(); string strCon = @"Driver=MySql ODBC 5.2 Unicode Driver;Server=172.168.0.234;Database=testss;UID=root;pwd=shinevod"; string sqlList1 = "select * from sms_outbox"; try { using (System.Data.Odbc.OdbcDataAdapter dataAdapter = new System.Data.Odbc.OdbcDataAdapter(sqlList1, strCon)) { dataAdapter.Fill(ds); Response.Write(ds.GetXml()); } } catch (Exception ex) { Response.Write(ex.ToString()); }
|
请发表评论