使用Command和DataReader对象:
(1).首先连接数据库:
string url="server=服务器名称;database=数据库名称;";uid=登录名;pwd=密码";
SqlConnection conn=new SqlConnection(url);
(2)连接对象command;
(3)编写CRUD sql语句;
(4)使用while循环动态赋值实体model;
(5)将model数据渲染到页面中;
使用Command和DataReader对象:
(1).首先连接数据库:
string url="server=服务器名称;database=数据库名称;";uid=登录名;pwd=密码";
SqlConnection conn=new SqlConnection(url);
(2)连接对象command;
(3)编写CRUD sql语句;
(4)使用while循环动态赋值实体model;
(5)将model数据渲染到页面中;