# dmdataconnect **Repository Path**: edocevol/dmdataconnect ## Basic Information - **Project Name**: dmdataconnect - **Description**: asp.net 使用大梦数据库 - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-12-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #
protected void Page_Load(object sender, EventArgs e)
{
if (Cache["key"] == null)
{
string strconn = "server=10.2.0.36;database=旧襄阳市市本级;User Id=SYSDBA;PWD=SYSDBA";
//DmConnection conn = new DmConnection(strconn);
string sql = "select top 100 * from 旧襄阳市市本级.分析表_近三年税款征收数据表 a,旧襄阳市市本级.分析表_近三年税款征收数据表 b,旧襄阳市市本级.分析表_近三年税款征收数据表 c where a.个人姓名=b.个人姓名 and b.个人姓名=c.个人姓名";
DmDataAdapter oda = new DmDataAdapter(sql, strconn);
DataTable dt = new DataTable();
Cache.Insert("key", dt, null, DateTime.Now.AddSeconds(100), System.Web.Caching.Cache.NoSlidingExpiration);
oda.Fill(dt);//填充datatable
dt.Dispose();//释放资源
oda.Dispose();//释放资源
this.GridView1.DataSource = dt;//给数据控件绑定数据源datatable
this.GridView1.DataBind();//刷新数据控件的数据源
}
else
{
this.GridView1.DataSource = Cache["key"];
this.GridView1.DataBind();//控件绑定数据之后,需要刷新的
}
}