Querying with the DataAdapter
The CData ADO.NET Provider for Blackbaud Raisers Edge NXT implements two ADO.NET interfaces you can use to retrieve data from BlackBaud Raiser's Edge NXT: RaiserEdgeNXTDataAdapter and RaiserEdgeNXTDataReader objects. Whereas RaiserEdgeNXTDataAdapter objects retrieve a single result set of all the data that matches a query, RaiserEdgeNXTDataReader objects fetch data in subset increments as needed.
Using the RaiserEdgeNXTDataAdapter
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 RaiserEdgeNXTDataAdapter is slower than the RaiserEdgeNXTDataReader because the Fill method needs to retrieve all data from the data source before returning.
The following example selects the Id and AddressLines columns of the Constituents table:
C#
string connectionString = "InitiateOAuth=GETANDREFRESH;SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;"; using (RaiserEdgeNXTConnection connection = new RaiserEdgeNXTConnection(connectionString)) { RaiserEdgeNXTDataAdapter dataAdapter = new RaiserEdgeNXTDataAdapter( "SELECT Id, AddressLines FROM Constituents", connection); DataTable table = new DataTable(); dataAdapter.Fill(table); Console.WriteLine("Contents of Constituents."); foreach (DataRow row in table.Rows) { Console.WriteLine("{0}: {1}", row["Id"], row["AddressLines"]); } }
VB.NET
Dim connectionString As String = "InitiateOAuth=GETANDREFRESH;SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;" Using connection As New RaiserEdgeNXTConnection(connectionString) Dim dataAdapter As New RaiserEdgeNXTDataAdapter("SELECT Id, AddressLines FROM Constituents", connection) Dim table As New DataTable() dataAdapter.Fill(table) Console.WriteLine("Contents of Constituents.") For Each row As DataRow In table.Rows Console.WriteLine("{0}: {1}", row("Id"), row("AddressLines")) Next End Using