Previous - dbTableData Section Home - Database Next - dbCount


dbDataBySQL ( )

Selectively filter the data to retrieve from the active connection by using SQL.

Usage:

dbDataBySQL (object me, string SQL)

Parameter:

SQL (string) - use standard SQL (Structured Query Language) to selectively filter data to retrieve. Microsoft provides some great tutorial on using SQL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp

Returns:

(2 Dimensional list) - with the inner list storing column data for each row, and the outer list storing the lists for each row

Example:

xtRose = xtra("Rosetta").new( )
xtRose.dbOpen( "Provider=MSDASQL;ExtendedAnsiSQL=2;DRIVER={Microsoft Access Driver (*.mdb)};Dbq="&the moviepath&"main" )
myData = xtRose.dbDataBySQL( "select [id] from [MSysAccessObjects]" )

Notes:

Use this method to quickly return a selective set of data back into Director.
You can also use SQL to update data values in the data file.
It is worth noting that not all SQL strings are created equally. Here are some examples of a simple query on different data providers

Provider SQL String
mySQL ODBC 3.51 Driver select * from myTable
Microsoft.Jet.OLEDB.4.0 select * from 'myTable'
MSDASQL select * from [myTable]

Previous - dbTableData Section Home - Database Next - dbCount