Database

Parameters

Methods for passing parameter values to SQL commands and stored procedures, and for using a grid as the parameter source.

Methods for passing parameter values to SQL commands and stored procedures, and for using a grid as the parameter source.

WithParameter adds a single parameter value to the parameter list in positional order. WithParameterGrid adds an entire IGPALGrid<string> as a set of parameters - each row becomes one set of parameter values for batch execution. WithParameterName sets the parameter name (required for named parameters in stored procedures). ClearParameters removes all previously added parameters from the list. Using(IGPALGrid<string>) or Using(DataTable) supplies parameters from a data set, enabling bulk operations.

Examples

GPAL Fluent: High-level fluent C# API

//WithParameter adds values positionally - they map to parameter placeholders in the order they are added. For named parameters (@name syntax), call WithParameterName before each WithParameter call.

// Named parameters for a stored procedure GPAL.Database .WithConnectionString(connStr) .WithStoredProcedure("usp_UpdateStatus") .WithParameterName("@customerId") .WithParameter("12345") .WithParameterName("@status") .WithParameter("active") .Update .Execute(out _); // Batch insert using a grid GPAL.Database .WithConnectionString(connStr) .WithSQLCommand("INSERT INTO Log (Message, Level) VALUES (@msg, @level)") .WithParameterGrid(logGrid) .Create .Execute(out _);