DoDataRead
| .NET Vuser Functions |
Reads records from a DataReader object.
void LrReplayUtils.DoDataRead( DbDataReader reader, DataTable valueTable, bool readToEnd, int numRecordsToRead );
VB.NET
Sub LrReplayUtils.DoDataRead( ByVal reader As DbDataReader, ByRef valueTable As DataTable, ByVal readToEnd As Boolean, ByVal numRecordsToRead As Integer)
| reader | The DataReader object to read records from. Input. |
| valueTable | A DataTable, to be filled with the values read from the DataReader. Output. |
| readToEnd | True to read all records available in the DataReader. False to read the number of records specified in numRecordsToRead. Input |
| numRecordsToRead | When readToEnd is false, read this number of records from the DataReader. Input. |
DoDataRead reads records from a DataReader object and outputs a DataTable containing the data.
Note: Do not add this function manually to a script. It is generated by VuGen automatically.
Parameterization
Parameterization is not applicable to this function.
Example
This example executes a data read from an SQL connection.
Example of a data reader
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
namespace DataReader {
class Program {
static void Main(string[] args) {
using ( SqlConnection connection = new SqlConnection(
ConfigurationManager.AppSettings["ConnectionString"])) {
connection.Open();
SqlCommand command = new SqlCommand(ConfigurationManager.AppSettings["Query"], connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
object o;
Console.WriteLine("---");
object o1 = reader.GetValue(4);
Console.WriteLine(o1);
}
// Call Close when done reading.
reader.Close();
}
}
}
}

