Share this page

# 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);

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: