Skip to main content

ReturnFromSQLComplex

Structure

ReturnFromSQLComplex(sSQL, sAction)

Parameters

ParameterTypeDescription
sSQLStringthe sql to be run against the IndySoft database. This sql should return only 1 field, and only the top record will be returned. The text should NOT end with a semicolon.
sActionStringMust be either 'OPEN' or 'EXEC'. This determines whether an Open action is called or an ExecSQL. If using ReturnFromSQL or RunSQL IndySoft auto-determines this from the presence of SELECT keyword at start - but in complex scenarios this is not always the case (DECLARE section, calling a stored procedure, etc.)

Return value

String

Description

This function is used to execute sql against the IndySoft database and return a single field and single record of data. So this function should only be used for returning precise information, typically used to populate other event fields. Note: this function works much like RunSQL, but does NOT do any automatic addition of NOLOCK syntax for SQL Server, and does NOT auto-insert owner from connection settings - this must all be done in sql text.

Example

sOwner = ReturnFromSQLComplex("SELECT GAGE_OWNER FROM GAGES WHERE COMPANY = '" &
LookupEquipmentCompany & "' AND GAGE_SN = '" & LookupEquipmentID & "'", "OPEN")
ShowMessage("This gage is owned by " & sOwner)

See also

RunSQLComplex