SqlClientFactory.CreateCommand 方法

定义

返回强类型的 DbCommand 实例。

public:
 override System::Data::Common::DbCommand ^ CreateCommand();
public override System.Data.Common.DbCommand CreateCommand ();
override this.CreateCommand : unit -> System.Data.Common.DbCommand
Public Overrides Function CreateCommand () As DbCommand

返回

DbCommand 的新强类型实例。

示例

以下代码片段返回强类型 DbCommand 实例:

Dim newFactory As SqlClientFactory = SqlClientFactory.Instance
Dim cmd As DbCommand = newFactory.CreateCommand()
SqlClientFactory newFactory = SqlClientFactory.Instance;
DbCommand cmd = newFactory.CreateCommand();

适用于

另请参阅