Querying with the DataAdapter
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 KintoneDataAdapter
Use the adapter's Fill method to retrieve data from the data source. An empty DataTable instance is passed as an argument to the Fill method. When the method returns, the DataTable instance is populated with the queried data. Note that the KintoneDataAdapter is slower than the KintoneDataReader because the Fill method needs to retrieve all data from the data source before returning.
The following example selects the CreatorName and Text columns of the Comments table:
C#
string connectionString = "User=myuseraccount;Password=mypassword;Url=http://subdomain.domain.com;GuestSpaceId=myspaceid"; using (KintoneConnection connection = new KintoneConnection(connectionString)) { KintoneDataAdapter dataAdapter = new KintoneDataAdapter( "SELECT CreatorName, Text FROM Comments", connection); DataTable table = new DataTable(); dataAdapter.Fill(table); Console.WriteLine("Contents of Comments."); foreach (DataRow row in table.Rows) { Console.WriteLine("{0}: {1}", row["CreatorName"], row["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 dataAdapter As New KintoneDataAdapter("SELECT CreatorName, Text FROM Comments", connection) Dim table As New DataTable() dataAdapter.Fill(table) Console.WriteLine("Contents of Comments.") For Each row As DataRow In table.Rows Console.WriteLine("{0}: {1}", row("CreatorName"), row("Text")) Next End Using