# 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 #
dmdataconnect

## 程序目的 1. 通过`ASP.NET`连接`达梦数据库7`,读取数据库中的数据,验证数据库服务器的性能 2. 实现数据读取的方式,利用`达梦数据库7`安装路径下的 `bin`文件夹下的 `DmProvider.dll` 动态链接库作为程序编写的基础。` 3. 利用`loadRunner`进行压力测试,开启`20`个虚拟`user`进行压力测试,主要测试放`Windows Server R2` 上进行,个人开发机器不用做测试。
## 代码文件说明 1. `index.aspx.cs`中实现了自连接的操作,并且添加了`Cache`,即缓存,提高效率,可以算作是作弊的行为吧。 2. `index2.aspx.cs`中实现了双表查询的操作,也使用了`Cache`,具体的就不再说明 3. `index3.aspx.cs`中实现了单表查询,已使用了`Cache`。
## 主要代码贴图

 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();//控件绑定数据之后,需要刷新的
    }
}