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



Our 911 dispatch center needed a program to monitor the status of equipment used in emergency situations. If one dispatcher modified the status of a piece of equipment, all the other dispatchers needed to see this change immediately. The most elegant way to implement this was by using Firebird Events to asynchronously notify all the users whenever a pertinent change had occurred at the database server. After failing to implement this myself using the Firebird API, I bought a copy of FIBPlus. I dropped a Database, EventAlert and ErrorHandler control into a C++ Builder DataModule and within minutes I had all the functionality I needed. I was able to complete the project quickly and the users are thrilled with the results because I gave them more features than they originally asked for. >>

Darryl Caillouet Programmer City of Little Rock
FOR CUSTOMERS
Download full versions and updates in your Personal Area