Question: I want to write arrays into an InterBase table. Why doesn't the following code work?

pFIBQuery1->>SQL->Add("INSERT INTO T(A) VALUES(:A)");
pFIBQuery1->>pFIBQuery1->PrepareArrayFields();
pFIBQuery1->>ParamByName("A")->SetArrayValue( A );

Answer: You should use the PrepareArraySqlVar instead of PrepareArrayFields. PrepareArrayFields works with the array fields, and you do not have any array fields in your code. The PrepareArraySqlVar method works with parameters and informs the library which table and field your parameter refers to. So the correct code should be:

pFIBQuery1->>SQL->Add("INSERT INTO T(A) VALUES(:A)");
pFIBQuery1->>pFIBQuery1->PrepareArrayFields();
pFIBQuery1->>PrepareArraySqlVar(pFIBQuery1->ParamByName("A"),"T","A",False);
pFIBQuery1->>ParamByName("A")->SetArrayValue( A );


Preview text: 
Prices in Euro:

235 (1 copy)
1250 (unlimited)

Volume discounts are available...

Navigation



I've looked at FIBPlus and feel that it is one of the fastest (if not the fastest) IB components out there. Congratulations on doing such a fine job. >>

Barry McClure
FOR CUSTOMERS
Download full versions and updates in your Personal Area