Click or drag to resize

DataExtensionsAddParametersWithValues Method

Creates and adds a new IDbDataParameter for each of the specified values to the IDbCommand object.

Namespace: GSF.Data
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public static void AddParametersWithValues(
	this IDbCommand command,
	string sql,
	params Object[] values
)
View Source

Parameters

command  IDbCommand
IDbCommand to which parameters need to be added.
sql  String
The SQL statement.
values  Object
The values for the parameters of the IDbCommand in the order that they appear in the SQL statement.

Return Value

The fully populated parameterized command.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDbCommand. 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).
Exceptions
ExceptionCondition
ArgumentExceptionNumber of IDbDataParameter arguments in sql expression, identified by '@', do not match number of supplied parameter values.
Remarks

This method does very rudimentary parsing of the SQL statement so parameter names should start with the '@' character and should be surrounded by either spaces, parentheses, or commas.

Do not use the same parameter name twice in the expression so that each parameter, identified by '@', will have a corresponding value.

See Also