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



When I had to find the best component to connect to my Firebird databases, FIBPlus imposed itself with its rapidity and reliability. Most importantly, it continued to evolve to be even better and whenever we had a problem, it was fixed promptly by Devrace team. We use FIBPlus in many projects related to Healthcare. We have hundreds of users who access databases up to 8 GB in size. I think there are many good third-party components out there, but not so many with an excellent support like the one provided for FIBPlus components. Thanks to you. >>

Evelyne Girard, Canada
FOR CUSTOMERS
Download full versions and updates in your Personal Area