ExecuteSQL
This function will execute a pass-through SQL statement on the host through the connection maintained by the server. Any results from the statement will be returned in a text-delimited object. (Note: this means that the item is a static view of the database and cannot be updated.)
Group: Server Extensions
Syntax: [bOK =] Server.ExecuteSQL(sSQL, [vColumns], [vRows])
bOK (Boolean) Optional – is a return value; a value of True means the SQL statement processed normally.
sSQL (String) is the SQL statement to be sent to the database. As this is a pass through statement, its syntax must be understood by the database, as no pre-processing will occur.
vColumns (Variant) – Optional – is a string representation of the columns returned by the SQL statement.
vRows (Variant) – Optional – is a string representation of the static result of an SQL statement.
Example:
Dim bOK As Boolean
Dim sSQL As String
Dim sCols As String
Dim sRows As String
sSQL = "select * from Inventory"
bOK = Server.ExecuteSQL(sSQL, sCols, sRows)
In the case of an insert or an update, the sCols and sRows variables would not be necessary.