Jump to content
Henry Olive

Parameter

Recommended Posts

Good Day

 

In Stored Procedure i can use below code

WHERE :CUSTNO IS NULL OR C.CUSTNO=:CUSTNO)

How can i  use above code inside Delphi (10,4) ?

SqlText := 'SELECT CUSTNO, CUSTNAME,EMAIL FROM CUSTOMER WHERE CUSTNO = :CUSTNO';

CDS1.CommandText := SqlText;

CDS1.Params[0].asString = ??     // If :CUSTNO = '' (Empty)  then show all Customers else just show choosen Customer

 

Thank You

 

 

 

 

 

Share this post


Link to post

Why not just execute the stored procedure from Delphi? 

 

I don't have any SQL statements in Delphi applications, just build the stored procedure parameters and use the ADO Execute method which returns a DataSet RecordSet that I parse for various results.   It means you can test all your SQL outside of Delphi.

 

Angus

 

 

 

Share this post


Link to post

Thank you Angus

I dont want to use S.Proc. as i wrote my prior message i know how to use params in S.Proc

but i want to use a dataset, query component inside Delphi

Share this post


Link to post

Just pass your literal SQL command to the Execute method, it returns a RecordSet which is a DataSet method.

 

Angus

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×