Querying with the DataReader
The CData ADO.NET Provider for Workday implements two ADO.NET interfaces you can use to retrieve data from Workday: WorkdayDataAdapter and WorkdayDataReader objects. Whereas WorkdayDataAdapter objects retrieve a single result set of all the data that matches a query, WorkdayDataReader objects fetch data in subset increments as needed.
Using the WorkdayDataReader
The WorkdayDataReader retrieves data faster than the WorkdayDataAdapter because it can retrieve data in pages. As you read data from the WorkdayDataReader, it periodically requests the next page of results from the data source, if required. This causes results to be returned at a faster rate. The following example selects all the columns from the [CData].[Human_Resources].Workers table:
C#
string connectionString = "ConnectionType=SOAP;User=myuser;Password=mypassword;Tenant=mycompany;BaseURL=https://wd3-impl-services1.workday.com"; using (WorkdayConnection connection = new WorkdayConnection(connectionString)) { WorkdayCommand cmd = new WorkdayCommand("SELECT * FROM [CData].[Human_Resources].Workers", connection); WorkdayDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["Worker_Reference_WID"], rdr["Legal_Name_Last_Name"])); } }
VB.NET
Dim connectionString As String = "ConnectionType=SOAP;User=myuser;Password=mypassword;Tenant=mycompany;BaseURL=https://wd3-impl-services1.workday.com" Using connection As New WorkdayConnection(connectionString) Dim cmd As New WorkdayCommand("SELECT * FROM [CData].[Human_Resources].Workers", connection) Dim rdr As WorkdayDataReader = cmd.ExecuteReader() While rdr.Read() Console.WriteLine([String].Format(vbTab & "{0} --> " & vbTab & vbTab & "{1}", rdr("Worker_Reference_WID"), rdr("Legal_Name_Last_Name"))) End While End Using