Hi All,
This might be a stupid question for some of you, but I have been battling with this for a while. I have a Variant Array where I keep on adding the elements and then execute the Query by setting the values in the Query with the ones in the Variant Array: Below is the sample code:
# CODE #1
The logic is very simple. If the Text I got from UI is Empty/NULL I PutElement as NULL in the vArrayElm (Variant Array) else if True then putElem as int 1 else int 0. Please note that the Column that I am trying to write to is of type
Name Type
------------------------
MY_COLUMN1 CHAR(1)
Below is the code that actually assigns the values to the variables in the Query:
# CODE #2
for (int i = 0; i < DataSet->FieldCount; i++)
{
Query->SetVariable(vPList->Strings, vArrayElm);
}
When I try to Set The Variable for MY_COLUMN1 (in CODE #2) as NULL (set by the code #1 above) I get an error: "Variant conversion error for for variable xMY_COLUMN1"
Any help is highly appreciated. What am I doing wrong? How can I set a NULL value in the Variant Array so that I don't get this exception while assigning the NULL value to the params in the Query using Query->SetVariable?
Thanks
This might be a stupid question for some of you, but I have been battling with this for a while. I have a Variant Array where I keep on adding the elements and then execute the Query by setting the values in the Query with the ones in the Variant Array: Below is the sample code:
# CODE #1
Code:
if (aCol->mDataType == ftInteger || aCol->mDataType == ftBoolean)
{
if (Text1.IsEmpty())
{
vArrayElm[FieldIndex].PutElement(Text, ArrayCount);
}
else
{
if (Text1 == "False")
Text1 = "0";
else if (Text1 == "True")
Text1 = "1";
vArrayElm[FieldIndex].PutElement(Text1.ToInt(), ArrayCount);
}
}
Name Type
------------------------
MY_COLUMN1 CHAR(1)
Below is the code that actually assigns the values to the variables in the Query:
# CODE #2
for (int i = 0; i < DataSet->FieldCount; i++)
{
Query->SetVariable(vPList->Strings, vArrayElm);
}
When I try to Set The Variable for MY_COLUMN1 (in CODE #2) as NULL (set by the code #1 above) I get an error: "Variant conversion error for for variable xMY_COLUMN1"
Any help is highly appreciated. What am I doing wrong? How can I set a NULL value in the Variant Array so that I don't get this exception while assigning the NULL value to the params in the Query using Query->SetVariable?
Thanks