Logo
Home Cart [Log In] About Us Contact Us

Object Reference

xf_DbSchema_ColumnDatabase Schema Column Information

Public Function FormatSqlColumn (
ColumnVal As Variant ,
InsertNewRec As Boolean ,
SQLNullList As String,
SQLTruncList As String,
SQLTypeMismatchList As String ,
Optional CheckForQuotedStrings As Boolean = False ,
Optional InDatasheetMode As Boolean = False ,
Optional DatasheetControl As Control = Empty ,
Optional OverrideSQLColumnFormat As xf_SQLColumnFormatEnum = xf_SQLColumnFormat_Unsupported ,
Optional NameMatchArray As Variant = Null
) As String

Formats the passed variant for inclusion in an SQL UPDATE/INSERT command, eg. Date, null, numeric etc.
Assumes that strings are not quoted prior to passing in.
Strings are quoted as part of the formatting operation, unless CheckForQuotedStrings=true and they are already quoted.

ColumnVal as Variant

The variant column value

InsertNewRec as Boolean

Validate for insertion of new record rather than updating an existing record.

SQLNullList as String

The list of column controls unable to be saved because their values are null

SQLTruncList as String

The list of columns whos values will be truncated by a save

SQLTypeMismatchList as String

The list of columns whos values are not able to be converted to the underlying type

Optional CheckForQuotedStrings as Boolean = False

Check for already-quoted string, and unquote and requote if detected (this will corrrect invalid escaping as a side effect)

Optional InDatasheetMode as Boolean = False

Validates the fact that Access datasheets cannot save an empty string (it is translated by the ODBC driver into a NULL), even if an empty string is allowed in the database column.

Optional DatasheetControl as Control = Empty

If passed, allows writing a truncated string back into the datasheet

Optional OverrideSQLColumnFormat as xf_SQLColumnFormatEnum = xf_SQLColumnFormat_Unsupported

Override the schema xf_SQLColumnFormatEnum with this one

Optional NameMatchArray as Variant = Null

A string array of colummn names and descriptions. Each element consists of the column name, a colon, then the column description.

Call Template:

Dim s As String
s = xf.DefaultSchema.TableSchema("tblSample").Columns.FormatSqlColumn(ColumnVal, InsertNewRec, SQLNullList, SQLTruncList, SQLTypeMismatchList)
s = xf.DefaultSchema.TableSchema("tblSample").Columns.FormatSqlColumn(ColumnVal, InsertNewRec, SQLNullList, SQLTruncList, SQLTypeMismatchList, CheckForQuotedStrings, InDatasheetMode, DatasheetControl, OverrideSQLColumnFormat, NameMatchArray)

See Also:

Example 1:

Dim objSchema As New xf_DbSchema
objSchema.Init xf_SQLDatabaseType_MSAccess, False, xf.DbConnect, "Default DB"
Contact Us :: About Us :: Policies :: email: infspamo@arrospamw-of-tispamme.com    © 2012 Arrow Of Time Pty Ltd