DelphiFAQ Home Search:

Stored procedures in a multi-tier environment

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

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:

// 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.

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;
You don't like the formatting? Check out SourceCoder then!

Comments:

2007-02-19, 23:55:44
anonymous from Iran  
How I can get avoid from 'Too Many Passwords' bde error in delphi?

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.