首页 > 其他 > 详细

5_添加购物车 D

时间:2018-12-19 20:14:41      阅读:122      评论:0      收藏:0      [点我收藏+]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MODEL;
using Dapper;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
public class ZhpDAL<T>
{
//显示+下拉绑定
string constr = "Data Source=.;Initial Catalog=week1;Integrated Security=True";
public List<T> GetList(string TableName)
{
var t = typeof(T);
var ts = t.GetProperties();
string sqlstr = "select ";
foreach (var item in ts)
{
sqlstr += item.Name+",";
}
sqlstr = sqlstr.Substring(0,sqlstr.Length - 1);
sqlstr += " from " + TableName;
using (IDbConnection con=new SqlConnection(constr))
{
return con.Query<T>(sqlstr).ToList();
}
}

}
}

5_添加购物车 D

原文:https://www.cnblogs.com/hianb/p/10145532.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!