Queries with parameters, an example please

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rogermon
Posts: 1
Joined: Sat 11 Feb 2006 22:48
Location: Minnesota, USA

Queries with parameters, an example please

Post by rogermon » Sat 11 Feb 2006 22:53

Hello,

I'm getting started with your package. Static queries seem to work fine, but I'm having no luck with using parameters in queries. Can anyone provide an example using parameters for input and output variables?

I can "build" query strings, but it would be nicer if I can avoid that.

Thanks in advance,

Roger

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 13 Feb 2006 12:32

Try using something like:

Code: Select all

        MSQuery.SQL.Text := 'SELECT * FROM emp WHERE empno = :empno'
        MSQuery1.Params.ParamValues['empno'] := 7839;
        MyQuery.Execute;
By the way, using parameters in SDAC is the same as in ADO, BDE. Please, refer to the Delphi Help for detailed information.

Post Reply