Returns the result-set of an SQL query to the database, as a string array of records.
Each element of the returned String array corresponds to one record of the result-set.
Each record contains fields delimited by delimiter. If the delimiter parameter is not used, then a comma is used as the default field delimiter.
Parameters:
Name |
Type |
Description |
sql |
String |
A valid sql statement to the connected database. See examples below. |
Returns:
Type |
Value |
Description |
String |
Array |
An array of type string.
Each element of the returned String array corresponds to one record of the result-set.
Each record contains fields delimited by delimiter. If the delimiter parameter is not used, then a comma is used as the default field delimiter. |
String |
"ERROR" |
If an error occurred, then the first element of the returned string array contains an item starting with "ERROR : " followed by the actual database error message. |
Available in:
WindowMain |
WindowLink |
YES |
YES |
Used in:
XojoScript Name |
GUID |
Calculate balance of finances |
6D428996-6DF1-4548-AEE3-117EC7E2D20C |
Count participants in events |
A31B7E5A-7D69-4B60-9434-23A7FE1B8F0B |
Create Cashregister list in Word |
219A0572-0F50-4FBE-AFCE-1092181C8BEF |
Create Seminar Invoice in Word |
D2036EFA-D283-481A-9A93-D00547680749 |
Create letter in Word, from address |
90AC7CD7-EE78-4659-8076-076E96B9EF5B |
Import ISR payment file |
52C27AC4-24B7-4B7D-9107-6223B4E10E45 |
Print Addresslist in Word |
A0503557-7DB7-4CC0-B08B-31005A0B1879 |
Save As Excel sheet : participants list |
E50602AA-F1F7-42E6-A44A-78456DD9B778 |
Save as Excel sheet : seminar invoice list |
6DDAFA87-2862-4129-8416-CBD57C5CDF9A |
Save as Excel sheet : seminar participants list |
03C22A3D-FF28-4E22-BB99-D7626BF5F0A4 |
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 '%SQLSelect%'
Example XojoScript:
// Count participants in events
Dim sql As String
Dim Records() As String
Dim total As String
sql = "SELECT Count(*) Total FROM " + GetPrefix + "link_adr_evt " _
+ "WHERE id_evt = " + Str(GetCurrentID)
// Store Results in Array
Records = SQLSelect(sql)
// Proceed if we have received any records
If Ubound(Records) > -1 Then
// If we produced an error, the returning record
// starts with the String : "ERROR"
If Left(Records(0),5)="ERROR" Then
MsgBox Records(0) // Display warning
Else
total = Records(0)
SetText("imTF_evt_Registrations",total)
End If
End If