Example: lr_db_executeSQLStatement

In the following example, lr_db_executeSQLStatement submits a query to a database. The dataset is pointed to by MyDataset and the number of rows in the dataset is saved to the NumRows variable.

    int NumRows=0;
NumRows = lr_db_executeSQLStatement("StepName=PerformQuery",
     "ConnectionName=db1",
     "SQLStatement=SELECT dbo.Customer.CustID, dbo.Customer.FirstName, dbo.Customer.LastName FROM dbo.Customer",
     "DatasetName=MyDataset",
     LAST );
    lr_output_message("The query returned %d rows.", NumRows);