These routines are used to allow you to prepare various data types for SQL
statements. Some of them determine if a valid data type is being submitted.
If it is not valid, "NULL" would be returned to submit into a database.
The most common routine is "SQLPrep_s" (standing for SQL Prepare String).
The first variable that you would pass to this routine is the string you are
going to prepare. The second is the length. The longest text/varchar field
can be 255 characters. If you have a memo/text field, then there is no
maximum length. You can get around this by entering a number less then 0.
Text/VarChar of 255 characters or less:
SQL = "INSERT INTO MyTable(Author) VALUES(" & SQLPrep_s("Lewis Moten", 255)
Text/VarChar 50 characters in length or less:
SQL = "INSERT INTO MyTable(Email) VALUES(" & SQLPrep_s("Lewis@Moten.com",
50) & ")"
SQL = "INSERT INTO MyTable(Page1) VALUES(" & SQLPrep_s(LargeParagraph, -1) &
Booleans are Yes/No, True/False fields. A Boolean field can not be null.
So if the data type is wrong, a default data type has to be passed. In the
following statement, if the Request field is not a valid answer (TRUE or
FALSE) then False is assigned. The value returned for TRUE my change (-1 or
1) depending on the version and type of database that you are using. The
notes in that function will explain which ones to use.
SQL = "INSERT INTO MyTable(21OrOlder) Values(" &
SQLPrep_b(Request("21OrOlder"), False) & ")"
The next statements only require the value itself. Null is returned if the
value is not of the correct type.
SQL = "INSERT INTO MyTable(LuckyNumber) VALUES(" &
SQLPrep_n(Request("LuckyNumber")) & ")"
SQL = "INSERT INTO MyTable(PostDate) VALUES(" & SQLPrep_d(Now()) & ")"
SQL = "INSERT INTO MyTable(GetPaid) VALUES(" & SQLPrep_c("$1234.56") & ")"