DbCommand.CommandText 属性

定义

在派生类中重写时,获取或设置对数据源运行的文本命令。When overridden in a derived class, gets or sets the text command to run against the data source.

public:
 abstract property System::String ^ CommandText { System::String ^ get(); void set(System::String ^ value); };
public abstract string CommandText { get; set; }
member this.CommandText : string with get, set
Public MustOverride Property CommandText As String

属性值

String

要执行的文本命令。The text command to execute. 默认值为空字符串 ("")。The default value is an empty string ("").

实现

注解

如果将设置 CommandTypeStoredProcedure ,则应将属性设置 CommandText 为存储过程的名称。When you set the CommandType to StoredProcedure, you should set the CommandText property to the name of the stored procedure. 当调用其中一种方法时,该命令将执行此存储过程 ExecuteThe command executes this stored procedure when you call one of the Execute methods.

适用于

另请参阅