Share this page

# lr_db_dataset_action

Performs an action on a dataset.

    int lr_db_dataset_action("StepName=<step_name>", "DatasetName=<dataset_name>", "Action=<action>", LAST );

Alphabetical Listing - C Language Utility Functions

## Arguments

Name | Comments
--- | ---
StepName | The name of the step, as it appears in the test tree. Any text can be used.
DatasetName | Logical name for the dataset specified in lr_db_executeSQLStatement.
Action | The action to perform on the dataset: RESET: Set the cursor to the first record of the dataset. REMOVE: Releases the memory allocated for the dataset. PRINT: Prints the contents of the entire dataset to the Replay Log and other test report summaries.
LAST | This delimiter marks the end of the argument list.

The lr_db_dataset_action function sets the cursor to the first record of the dataset, removes it from memory, or prints the dataset to the Replay Log.

This function is supported only under the Windows operating system.

When printing a dataset, only the first one hundred records are listed in the test report summaries. The total number of records is also listed.

## Return Values

This function returns LR_PASS on success and LR_FAIL on failure.

## Parameterization

All string arguments (char type) can be parameterized using standard parameterization.

## Example

In the following example, lr_db_dataset_action removes the dataset that was created by lr_db_executeSQLStatement.

Copy code

    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_db_dataset_action("StepName=RemoveDataset", "DatasetName=MyDataset", "Action=REMOVE", LAST );

In the following example, lr_db_dataset_action prints the contents of the dataset to the Replay Log.

Copy code

        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_db_dataset_action("StepName=PrintDataset", "DatasetName=MyDataset", "Action=PRINT", LAST );

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