ADO.NET Provider for Kintone

Build 24.0.9060

Querying with the DataReader

The CData ADO.NET Provider for Kintone implements two ADO.NET interfaces you can use to retrieve data from Kintone: KintoneDataAdapter and KintoneDataReader objects. Whereas KintoneDataAdapter objects retrieve a single result set of all the data that matches a query, KintoneDataReader objects fetch data in subset increments as needed.

Using the KintoneDataReader

The KintoneDataReader retrieves data faster than the KintoneDataAdapter because it can retrieve data in pages. As you read data from the KintoneDataReader, 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 Comments table:

C#

string connectionString = "User=myuseraccount;Password=mypassword;Url=http://subdomain.domain.com;GuestSpaceId=myspaceid";

using (KintoneConnection connection = new KintoneConnection(connectionString)) {
  KintoneCommand cmd = new KintoneCommand("SELECT * FROM Comments", connection);
  
  KintoneDataReader rdr = cmd.ExecuteReader();

  while (rdr.Read()) {
    Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["CreatorName"], rdr["Text"]));
  }
}

VB.NET

Dim connectionString As String = "User=myuseraccount;Password=mypassword;Url=http://subdomain.domain.com;GuestSpaceId=myspaceid"

Using connection As New KintoneConnection(connectionString)
  Dim cmd As New KintoneCommand("SELECT * FROM Comments", connection)

  Dim rdr As KintoneDataReader = cmd.ExecuteReader()

  While rdr.Read()
    Console.WriteLine([String].Format(vbTab & "{0} --> " & vbTab & vbTab & "{1}", rdr("CreatorName"), rdr("Text")))
  End While
End Using

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060