sc_select(dataset, "SQL Command", "Connection")
|
|
This macro executes the SQL commands passed as parameter and access the "dataset" in the command.
Different from sc_lookup macro, this macro doesn't manipulate the dataset (the user is responsible for all the manipulation).
If an error occurs in the sql command execution, the variable attributed to the database returns as "false" and the error message is available in the "dataset_error" variable.
The connection parameter is optional, use only if the command is executed in a data base different from the specified in the application. In this parameter it is not possible to use variables.
Ex. 1: sc_select(my_data, "select clientId, clientName, limitecred from costumers"); if ({my_data} === false) { echo "Access error. Message =". {my_data_erro}; } else { while (!{my_data}->EOF) { {clientName} = {my_data}->fields[1]; {my_data}->MoveNext(); } {my_data}->Close(); }
Ex. 2: The SQL command can passed as application fields (local variables) or of global variables. sc_select(dataset,"select price order from order where clientId = '{clientId}' and cod_Seller = [var_glo_seller]");
Note: The command must always be finished with semicolon";".
|
Macro Scope
|
Blank application
|
calendar application
|
chart application
|
Grid application
|
Dashboard
|
Search application
|
Form application
|
Control Form
|
Menu application
|
Responsive Menu
|
Tree menu
|
ReportPDF application
|
allMacros onExecute
|
ajaxFieldonBlur ajaxFieldonChange ajaxFieldonClick ajaxFieldonFocus allMacros onAfterDelete onAfterInsert onAfterUpdate onBeforeDelete onBeforeInsert onBeforeUpdate onCalendarScriptInit onInit onLoadAll onRefresh onValidate onValidateFailure onValidateSuccess
|
allMacros onFooter onHeader onInit
|
ajaxFieldonClick allMacros onFooter onGroupBy onHeader onInit onNavigate onRecord
|
allMacros onInit onWidgetLoad
|
allMacros onFilterInit onFilterRefresh onFilterSave onFilterValidate
|
ajaxFieldonBlur ajaxFieldonChange ajaxFieldonClick ajaxFieldonFocus allMacros onAfterDelete onAfterDeleteAll onAfterInsert onAfterInsertAll onAfterUpdate onAfterUpdateAll onBeforeDelete onBeforeDeleteAll onBeforeInsert onBeforeInsertAll onBeforeUpdate onBeforeUpdateAll onClick onInit onLoadAll onNavigate onRecord onRefresh onValidate onValidateFailure onValidateSuccess
|
ajaxFieldonBlur ajaxFieldonChange ajaxFieldonClick ajaxFieldonFocus allMacros onClick onInit onLoadAll onRefresh onValidate onValidateFailure onValidateSuccess
|
allMacros onApplicationInit onExecute onLoad
|
onApplicationInit onExecute onLoad
|
allMacros onExecute onLoad
|
allMacros onFooter onHeader onRecord
|
|