2012年10月17日

摘要: 需要从SQL查询中返回一个值,如表中记录数。可以使用ExecuteScalar()方法,这个方法只返回一个值。如下边控制台应用程序代码所示:usingSystem.Data;usingSystem.Data.SqlClient;namespaceExecuteScalar{classProgram{staticvoidMain(string[]args){SqlConnectionthisConnection=newSqlConnection(@"DataSource=scott;InitialCatalog=northwind;PersistSecurityInfo=True;Us 阅读全文
posted @ 2012-10-17 21:33 gongth_12 阅读(140) 评论(0) 推荐(0) 编辑

导航