2004年4月29日

有关SqlDataReader的性能比较

摘要: If you need to retrieve a single row, use one of the following options:1、 Use stored procedure output parameters.2、 Use a SqlDataReader object. Both options avoid the unnecessary overhead of cr... 阅读全文

posted @ 2004-04-29 15:17 mist 阅读(1139) 评论(0) 推荐(0) 编辑

2004年4月28日

使用SqlDataReader注意的几点

摘要: 1、当SqlDataReader没有关闭之前,数据库连接会一直保持open状态,所以在使用SqlDataReader时,使用完毕应该马上调用SqlDataReader.Close()关闭它。2、一个连接只能被一个SqlDataReader使用,这也是为什么要尽早关闭SqlDataReader的原因。3、使用完SqlDataReader后,你可以在程序中显示的调用数据库连接对象的Close方法关闭连... 阅读全文

posted @ 2004-04-28 18:02 mist 阅读(9751) 评论(9) 推荐(2) 编辑

2004年4月22日

Windows Forms中DataGrid绑定到ArrayList和数组,设置TableStyle

摘要: 在Windows Forms中绑定DataGrid时,绑定到DataSet时,设置TableStyle的MappingName为DataTable的名字就可以了,在绑定到ArrayList和数组时,MappingName该如何指定呢。1、绑定到ArrayList: tableStyle.MappingName = "ArrayList";2、绑定到数组 System.Drawing... 阅读全文

posted @ 2004-04-22 10:40 mist 阅读(1927) 评论(3) 推荐(0) 编辑

关于SqlDataAdapter的使用

摘要: 如果使用SqlDataAdapter来查询数据返回给DataSet或者DataTable时需要注意以下几点:1、如果SqlDataAdapter的SelectCommand的连接并没有打开,使用SqlDataAdapter的Fill方法时会自动打开数据库连接,并在方法执行完毕自动关闭连接。如果连接在使用Fill方法之前已经打开,方法执行结束后会保持连接的现有状态,不会关闭连接。2、如果你在同一个C... 阅读全文

posted @ 2004-04-22 10:00 mist 阅读(1620) 评论(0) 推荐(0) 编辑

2004年4月19日

数据库连接串

摘要: ,发现了一个比较好的网址http://www.connectionstrings.com/如果你忘记了在.net中访问数据库的连接串的写法,到这上面找找看。找到一本书《.NET Data Access Architecture Guide》,准备边看边翻译。我E文很差,希望译出来的东西别太差了。 阅读全文

posted @ 2004-04-19 13:15 mist 阅读(740) 评论(0) 推荐(0) 编辑

导航