日期:2014-05-17 浏览次数:20398 次
using Microsoft.Practices.EnterpriseLibrary;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using MySql.Data;
using MySql.Data.MySqlClient; Database db = DatabaseFactory.CreateDatabase();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
DbCommand command = db.GetSqlStringCommand("SELECT * FROM e_phonesetting");
db.ExecuteNonQuery(command);
GridView2.DataSource = db.ExecuteDataSet(command).Tables[0];
GridView2.DataBind();
}
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/>
</configSections>
<dataConfiguration defaultDatabase="Connection String MySql">
</dataConfiguration>
<connectionStrings>
<clear/>
<add name="Connection String MySql" connectionString="server=10.10.10.119:3306; user id=testMsql; password=123456; database=mm;CharSet=utf8" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>