Skip to content

Latest commit

 

History

History
52 lines (42 loc) · 1.86 KB

CreateCommand_2.md

File metadata and controls

52 lines (42 loc) · 1.86 KB

Extensions.CreateCommand Method (DbConnection, SqlBuilder)

Creates and returns a DbCommand object from the specified sqlBuilder.

Namespace: DbExtensions
Assembly: DbExtensions (in DbExtensions.dll)

Syntax

public static DbCommand CreateCommand(
	this DbConnection connection,
	SqlBuilder sqlBuilder
)

Parameters

connection

Type: System.Data.Common.DbConnection
The connection used to create the command.

sqlBuilder

Type: DbExtensions.SqlBuilder
The SqlBuilder that provides the command's text and parameters.

Return Value

Type: DbCommand
A new DbCommand object whose CommandText property is initialized with the sqlBuilder's string representation, and whose Parameters property is initialized with the values from the ParameterValues property of the sqlBuilder parameter.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DbConnection. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

Extensions Class
DbExtensions Namespace
Extensions.CreateCommand(DbConnection, String, Object[])