TUniQuery Invalid value Error CodeGear 2007 C++
Posted: Thu 04 Oct 2018 19:08
I have created a test program to interact with a MongoDB. I have 3 components (that I have added to the form. Insert, Delete and update all work. I am having an issue with Find.
The first time find is called it works and returns expected data. However, I am getting an Invalid value error when assigning text to the TUniQuery from an edit box or a rich edit. The error is occurring before the before the query is activated. Below is the button logic I am using:
void __fastcall TForm1::Button4Click(TObject *Sender)
{
if (!MongoConn->Connected) {
ShowMessage("Connect to db first");
return;
}
if (MongoQuery->Active) {
MongoQuery->Close();
MongoQuery->SQL->Clear();
Mresult->Lines->Clear();
MongoData->Enabled = False;
Button4->Caption="Find";
}
else {
MongoQuery->SQL->Text = mFind->Text;
MongoQuery->Open();
MongoData->DataSet = MongoQuery;
MongoData->Enabled = True;
Button4->Caption="Active";
ShowResults();
}
}
The error is occurring on MongoQuery->SQL->Text = mFind->Text;. Even if using the same search criteria. No matter what I enter, the same invalid value error occurs on the 2nd attempt even if running another insert/delete/update in between finds. Is there a part that I am forgetting to clear?
Thanks, Brad
The first time find is called it works and returns expected data. However, I am getting an Invalid value error when assigning text to the TUniQuery from an edit box or a rich edit. The error is occurring before the before the query is activated. Below is the button logic I am using:
void __fastcall TForm1::Button4Click(TObject *Sender)
{
if (!MongoConn->Connected) {
ShowMessage("Connect to db first");
return;
}
if (MongoQuery->Active) {
MongoQuery->Close();
MongoQuery->SQL->Clear();
Mresult->Lines->Clear();
MongoData->Enabled = False;
Button4->Caption="Find";
}
else {
MongoQuery->SQL->Text = mFind->Text;
MongoQuery->Open();
MongoData->DataSet = MongoQuery;
MongoData->Enabled = True;
Button4->Caption="Active";
ShowResults();
}
}
The error is occurring on MongoQuery->SQL->Text = mFind->Text;. Even if using the same search criteria. No matter what I enter, the same invalid value error occurs on the 2nd attempt even if running another insert/delete/update in between finds. Is there a part that I am forgetting to clear?
Thanks, Brad