获取或设置一个值,指明命令的类型。
语法
[Visual Basic]
Public Overrides Property CommandType As CommandType
Get
Set
[C#]
public override CommandType CommandType { get; set; }
属性值
CommandType 可以设置的值有:
Text :SQL 文本命令(默认)
;
StoredProcedure :存储过程的名称;
TableDirect :表的名称。
实现
IDbCommand.CommandType
注释
当CommandType 属性设置成StoredProcedure 时, CommandText 属性应该
GBase 8a 程序员手册ADO.NET 篇
- 132 -
南大通用数据技术股份有限公司
设置为存储过程的名字。在用户调用Execute 方法的时候,这个命令就执行这
个存储过程。
示例
下面的例子创建了GBaseCommand 且设置了它的一些属性。
[Visual Basic]
Public Sub CreateGBaseCommand()
Dim gsCommand As New GBaseCommand()
gsCommand.CommandType = CommandType.Text
End Sub
[C#]
public void CreateGBaseCommand()
{
GBaseCommand gsCommand = new GBaseCommand();
gsCommand.CommandType = CommandType.Text;
}