Executing Stored Procedures

The steps to executing a stored procedure is just as straightforward as executing other non-query commands. Listing 19.5 illustrates these steps.

Listing 19.5. Stored Procedure Example
1: program sp_addco; 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_ddn_add_company = 'ddn_add_company'; 15: var 16: sqlcon: SqlConnection; 17: cmd: SqlCommand; 18: param: SqlParameter; 19: begin 20: sqlcon := SqlConnection.Create(c_cnstr); 21: cmd := SqlCommand.Create(c_ddn_add_company, sqlcon); 22: cmd.CommandType ...

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.