Dapper 框架

时间:2021-06-20 18:40:15

 

 

 

/// Dapper 框架应用例子
            /// 1. NuGet安装 Dapper
            /// 2. using 就可以使用下面例子
            string sql = "SELECT SNAME,SUSER,SDATE,SFLAG,SNUM,CST1,CST2 FROM IIDB_SYN";
            string connstring = ConfigurationManager.ConnectionStrings["Model2conn"].ConnectionString;
            using (IDbConnection db = new SqlConnection(connstring))
            {
                var idt = db.Query<Mode.IIDB_SYN>(sql);
                DataTable dt = ToDataTable(idt);
            }