Process Mapping Logo

Process Mapping - Articles

A Process of Improvement. An Outcome of Excellence.

SelectSql() for inserts and updates as well as selects

SelectSql() has a very useful feature that allows you to use parameters instead of trying to format variables correctly for SQL. What is not commonly known is that you can use select SQL for all database activities not just for select statements.

For example you can easily use the following statement:

Quote:

SelectSql(null, "UPDATE eSession SET eLastActivityTime = @Now WHERE eUserName = @UserName", SQLArg("@Now", ProcessContext.CurrentTime), SQLArg("@UserName", "bo'brien"));

which saves a lot of messing about formatting time and text variables.