Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem setting param in Interbase dataset

Status
Not open for further replies.

Kocky

Programmer
Oct 23, 2002
357
NL
Hello,

I have the following problem.
I have a form that contains a frame and on this frame is a datasource component that is connected to a Interbase Dataset component. This Interbase dataset component contains the following SelectSQL statement:

Select *
from Customer C
Where C.CustomerNr = :pCUSTOMERNR

I don't manage to get the parameter "pCUSTOMERNR" to be set from within my form. I perform the following call:

(frameCustomer.dsrcDataSetCustomer.DataSet AS TIBDataset).Params.ByName('pCUSTOMERNR').AsString := '1';

The statement is executed but the SQL statement is not modified. Any ideas anyone ?

Greetings,

Pascal.
 
Setting a param does not modify the SQL statement. That is how the component works.

What happens when you open the dataset? Does it return the result set that you expect?


Andrew
 
After you modify the parameter you have to call open or active for the dataset (or query) to get the results

Steven van Els
SAvanEls@cq-link.sr
 
After I called "ParamByName" I displayed a messagebox containing the SelectSQL value. But it does not show the value of the parameter, which is obvious. The dataset holds al it's parameters in the "Params" object including the name of the parameter and its value.
Also before setting the parameter I forgot to first close the dataset.

Everything solved now.

Thanx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top