Database.SQLExecute

From Xojo Documentation
Jump to: navigation, search
Method

Database.SQLExecute(ExecuteString as String)

Used to execute an SQL command. Use this for commands that do not return any data, such as CREATE TABLE or INSERT. ExecuteString contains the SQL statement.

Notes

To avoid SQL Injection, be sure to use Prepared SQL Statements.

Example

This code creates the Team table:

// App.DB is a SQLite database
Dim sql As String
sql = "CREATE TABLE Team (ID INTEGER NOT NULL, Name TEXT, Coach TEXT, City TEXT, PRIMARY KEY(ID));"

App.DB.SQLExecute(sql)

If App.DB.Error Then
MsgBox("DB Error: " + App.DB.ErrorMessage)
Else
MsgBox("Team table created successfully.")
End If
Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About