Главная страница | назад





Article #15514: Using Stored Procedures

 Question and Answer Database
FAQ514D.txt Using Stored Procedures
Category :DCOM/MultiTier/ActiveForm
Platform :All
Product :Delphi 3.x
Question:
How do I use stored procedures in a multi-tier environment?
Answer:
You'll need to get the provider interface and set the
parameters before trying to open the client dataset.
Unfortunately there is no way to do this at design time,
but it should work OK at run time. Here is some code that
shows basically what you need to do:
?
procedure TDBClientTest.Button3Click(Sender: TObject); var Params: Variant; begin ClientData.Provider := RemoteServer1.GetProvider('ProviderName'); Params := VarArrayCreate([0, 1], varVariant); Params[0] := VarArrayOf(['@InParam1', 101]); Params[1] := VarArrayOf(['@InParam2', 'test_param']); ClientData.Provider.SetParams(Params); ClientData.Open; end; ?
This example assumes the stored procedure takes 2 parameters, and binds them by name. If you need to update the data returned from a stored procedure, you will need to use a TUpdateSQLProvider. 7/16/98 4:31:28 PM

Last Modified: 01-SEP-99