打印本文 打印本文 关闭窗口 关闭窗口
第三课 SqlCommand对象(翻译)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数14790  更新时间:2007/11/14 13:12:47  文章录入:mintao  责任编辑:mintao
介绍

A SqlCommand object allows you to specify what type of interaction you want to perform with a data base.  For example, you can do select, insert, modify, and delete commands on rows of data in a data base table.  The SqlCommand object can be used to support disconnected data management scenarios, but in this lesson we will only use the SqlCommand object alone.  A later lesson on the SqlDataAdapter will explain how to implement an application that uses disconnected data.  This lesson will also show you how to retrieve a single value from a data base, such as the number of records in a table.

SqlCommand对象允许你指定在数据库上执行的操作的类型。比如,你能够对数据库中的行数据执行selectinsertmodify以及delete命令。SqlCommand对象能被用来支持断开连接数据管理的情况,但是在这节课我们将只单独使用SqlCommand对象。后面关于SqlDataAdapter的课程将解释如何使用断开数据实现应用程序。这节课将同时展示如何从数据库中返回一个单独的值,比如表中记录的数量。

Creating a SqlCommand Object

创建SqlCommand对象

Similar to other C# objects, you instantiate a SqlCommand object via the new instance declaration, as follows:

与其他C#对象相似,通过new实例声明来实例化SqlCommand对象:

    SqlCommand cmd = new SqlCommand("select CategoryName from Categories", conn);

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口