Product Logo

CNS Query

Query your databases without relationships.

Functions

CNSQuery_ExecuteSQL

NameCNSQuery_ExecuteSQL
Description

This function allows you to use SQL statements to run queries against the current Database File. If the Query you are using will be returning Field values and multiple Records, you can optionally define the Separators that should be placed between the Fields and Records using the last two parameters. By default, CNS Query will use a comma between multiple Fields and a return between multiple Records. The Field and Record Separators you specify are not limited to a single character.

Return TypeText
FormatCNSQuery_ExecuteSQL ( SQL ; FieldSeparator ; RecordSeparator )
Required Parameters
SQL

The SQL statement to evaluate against the current Database File.

Optional Parameters
FieldSeparator

The Separator to use between multiple Fields when doing an SQL Select. By default, Fields will be separated with a comma.

RecordSeparator

The Separator to use between multiple Records when doing an SQL Select. By default, Records will be separated with a return.

Examples
Example 1

Returns every field and every record from the "MyTable" Table.

CNSQuery_ExecuteSQL( "select * from MyTable" )
Example 2

Returns something like "<tr><td>Mary</td><td>Jones</td></tr>" for every record in the "MyTable" Table.

CNSQuery_ExecuteSQL( "select '<tr><td>' + \"First\", \"Last\" + '</td></tr>' from MyTable" ; "</td><td>" )