Execute a stored procedure via an IDbCommand (that returns a resultset) against the specified IDbConnection using the provided parameter values. This method will query the database to discover the parameters for the stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.

Namespace: CodeSmith.Engine
Assembly: CodeSmith.Engine (in CodeSmith.Engine.dll) Version: 6.0.0.0 (7.0.0.15127)

Syntax

C#
public virtual void FillDataset(
	IDbConnection connection,
	string spName,
	DataSet dataSet,
	string[] tableNames,
	params Object[] parameterValues
)
Visual Basic
Public Overridable Sub FillDataset ( 
	connection As IDbConnection,
	spName As String,
	dataSet As DataSet,
	tableNames As String(),
	ParamArray parameterValues As Object()
)

Parameters

connection
Type: System.Data..::..IDbConnection
A valid IDbConnection
spName
Type: System..::..String
The name of the stored procedure
dataSet
Type: System.Data..::..DataSet
A dataset wich will contain the resultset generated by the command
tableNames
Type: array<System..::..String>[]()[][]
This array will be used to create table mappings allowing the DataTables to be referenced by a user defined name (probably the actual table name)
parameterValues
Type: array<System..::..Object>[]()[][]
An array of objects to be assigned as the input values of the stored procedure

Remarks

This method provides no access to output parameters or the stored procedure's return value parameter.

Examples

 Copy imageCopy
helper.FillDataset(conn, "GetOrders", ds, new string[] {"orders"}, 24, 36);

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionThrown if spName is null
System..::..ArgumentNullExceptionThrown if connection is null

See Also