Querying a Resultset

The SQLDataReader class can be used to query a single or multiple resultsets. Listing 19.8 illustrates the single resultset technique.

Listing 19.8. Using SqlDataReader on a Single Resultset
1: program rsltset; 2: 3: {$APPTYPE CONSOLE} 4: 5: {%DotNetAssemblyCompiler 'C:\windows\microsoft.net\framework\v1.1.4322\System.Data.dll'} 6: 7: uses 8: SysUtils, 9: System.Data, 10: System.Data.SqlClient; 11: 12: const 13: c_cnstr = 'server=XWING;database=ddn_company;Trusted_Connection=Yes'; 14: c_select_company = 'select company_id, company_name from company'; 15: var 16: sqlcon: SqlConnection; 17: cmd: SqlCommand; 18: rdr: SqlDataReader; 19: begin 20: sqlcon := SqlConnection.Create(c_cnstr); 21: cmd := SqlCommand.Create(c_select_company, ...

Get Delphi for .NET Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.