Home Cart [Log In] About Us Contact Us

Object Reference

xf_SchemaSQLConstructorSQL Constructor

Public Function MakeUpdateOrInsertFromVals (
TableName As String,
InsertNewRec As Boolean,
WhereClause As String,
ParamArray FieldValList() As Variant
) As String

Create an update or insert statement from the passed in values, validating and formatting each value according to the column type. For INSERT statements validation also includes checking table columns that have not been specified in the passed list, to ensure they are either nullable or have a default value.

TableName as String

The table name

InsertNewRec as Boolean

Create an INSERT statement rather than an UPDATE

WhereClause as String

The WHERE clause (without the WHERE keyword) for the UPDATE statement

ParamArray FieldValList() as Variant

The paired column names and values

Call Template:

Dim s As String
s = xf.DefaultSchema.SQLConstructor.MakeUpdateOrInsertFromVals(TableName, InsertNewRec, WhereClause, FieldValList)

See Also:

Example 1:

sql = objSchema.SQLConstructor.MakeUpdateOrInsertFromVals "Product", True, "", _
"ProductName", "Chai", _
"Price", 13.23
If sql <> "" Then xf.DbConnect.RunSQL sql
Contact Us :: About Us :: Policies :: email: infspamo@arrospamw-of-tispamme.com    © 2012 Arrow Of Time Pty Ltd