SQLExecute(sql As String) As String

 

Used to execute an SQL command.

 

Use this for commands that do not return any data, such as UPDATE or INSERT.

 

sql contains the SQL statement.

  

Parameters:

 

Name

Type

Description

sql

String

A valid sql statement to the connected database.

See example below.

 

Returns:

 

Type

Value

Description

String

empty string

The sql statement was successfully executed.

String

ERROR

If an error occurred, then the returned string starts with "ERROR" followed by the actual database error message.

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

 Used in:

 

XojoScript Name

GUID

Import ISR payment file

52C27AC4-24B7-4B7D-9107-6223B4E10E45

 

Hint: You can find more references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%SQLExecute%'

 

Example XojoScript:

 

Dim code As String = "deprecated"

Dim description As String = "Do not use if deprecated!"

Dim sql,result As String

Dim MsgResult As Integer

 

sql = "INSERT INTO " + GetPrefix + "code_status (" _

+ "Code,Description) VALUES ('" _

+ code + "','" _

+ description + "')"

 

result = SQLExecute(sql)

 

If InStr(result,"ERROR")>0 Then

MsgResult = MsgBox(result + EOL + EOL + "Continue?",17)

 

// Cancel Pressed

If MsgResult = 2 Then

Return

End If  // MsgResult = 2

End If