Querying the Data
RSSBus Google ADO.NET Provider offers two ways to retrieve data from Google: GoogleDataAdapter objects and GoogleDataReader objects. Each object accomplishes the same task -- retrieving data -- but does so in a different way. Whereas GoogleDataAdapter objects retrieve all the data that matches a query wholesale, GoogleDataReader objects fetch data in subset increments as they are needed.
Using The GoogleDataAdapter
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 will be populated with the queried data:
The example below selects the Id and Title columns of the Calendar table.
GoogleDataAdapter dataAdapter = new GoogleDataAdapter(
"SELECT Id, Title FROM Calendar", connection);
DataTable table = new DataTable();
dataAdapter.Fill(table);
Console.WriteLine("Contents of Calendar.");
foreach (DataRow row in table.Rows) {
Console.WriteLine("{0}: {1}", row["Id"], row["Title"]);
}
Using The GoogleDataReader
In this next example, we use a GoogleDataReader to get data from Google. The example below
selects all the columns from the Calendar table.
GoogleCommand cmd = new GoogleCommand("SELECT * FROM Calendar");
GoogleDataReader rdr = cmd.ExecuteReader();
while (rdr.Read()) {
Console.WriteLine(String.Format("\t{0} --> \t\t{1}", rdr["Id"], rdr["Title"]));
}
Supported SQL Syntax
The RSSBus Google ADO.NET Provider supports a restricted subset of the SQL Syntax. See SELECT Statements for details.