Method

Database_Class.SQLExecute


Warning

This item was deprecated in version 2019r2. Please use Database.ExecuteSQL as a replacement.

Description

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 or Database.ExecuteSQL.

Sample code

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

Compatibility

All project types on all supported operating systems.