码迷,mamicode.com
首页 > 其他好文 > 详细

使用DataReader

时间:2014-12-08 12:20:21      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:ar   使用   sp   on   数据   bs   ad   new   nbsp   

string sqlStr="select * from tb_news";

SqlCommand myCmd=new SqlCommand(sqlStr,myConn);

myCmd.CommandType=CommandType.Text;

SqlDataReader myDr=myCmd.ExecuteReader();

过程:

创建连接

打开连接

创建Command对象

执行Command的ExecuteReader方法

将DataReader绑定到数据控件中.

关闭DataReader.

关闭连接

 

使用DataReader

标签:ar   使用   sp   on   数据   bs   ad   new   nbsp   

原文地址:http://www.cnblogs.com/handsomer/p/4150644.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!