Thread View: borland.public.cppbuilder.database.ado
4 messages
4 total messages
Started by Khai Trinh
Tue, 19 Sep 2006 23:06
How to do filtering
Author: Khai Trinh
Date: Tue, 19 Sep 2006 23:06
Date: Tue, 19 Sep 2006 23:06
16 lines
1282 bytes
1282 bytes
Hi, Here's part of my code: line 1. ADOQuery1->SQL->Text = "select x1,x2 from table1"; line 2. ADOQuery1->Filtered = true; line 3. ADOQuery1->Filter = "Production"; line 4. ADOQuery1->Active = true; At line 4, I get the error below: "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another." Production is a bit field in table1 of a SQL database. Any help for solving this is greatly appreciated. Thanks, Khai
Re: How to do filtering
Author: Bob Swart
Date: Wed, 20 Sep 2006 06:39
Date: Wed, 20 Sep 2006 06:39
30 lines
1877 bytes
1877 bytes
Hi Khai,
> Here's part of my code:
> line 1. ADOQuery1->SQL->Text = "select x1,x2 from table1";
> line 2. ADOQuery1->Filtered = true;
> line 3. ADOQuery1->Filter = "Production";
> line 4. ADOQuery1->Active = true;
Change it as follows:
ADOQuery1->SQL->Text = "select x1,x2 from table1";
ADOQuery1->Active = true;
ADOQuery1->Filter = "Production = 1"; // for example
ADOQuery1->Filtered = true;
> At line 4, I get the error below:
> "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."
It's about the filter expression - it's not an expression.
> Thanks,
> Khai
Groetjes,
Bob Swart
--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
Blog: http://www.drbob42.com/blog - RSS: http://drbob42.com/weblog.xml
New Delphi 2006 Courseware e-books at http://www.eBob42.com/courseware
Re: How to do filtering
Author: Viatcheslav V. Vassiliev
Date: Wed, 20 Sep 2006 07:23
Date: Wed, 20 Sep 2006 07:23
32 lines
2138 bytes
2138 bytes
In addition, if you filter using column Production, it should be in select, i.e. x1 or x2 should be Production. //------------------------------------------ Regards, Vassiliev V. V. http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + ADO.Net http://www.oledbdirect.com - The fastest way to access MS SQL Server, MS Jet (Access) and Interbase (through OLEDB) "Khai Trinh" <khai.trinh1@navy.mil> �������/�������� � �������� ���������: news:4510780b$1@newsgroups.borland.com... > > Hi, > > Here's part of my code: > line 1. ADOQuery1->SQL->Text = "select x1,x2 from table1"; > line 2. ADOQuery1->Filtered = true; > line 3. ADOQuery1->Filter = "Production"; > line 4. ADOQuery1->Active = true; > > At line 4, I get the error below: > "Arguments are of the wrong type, are out of acceptable range, or are in > conflict with one another." > > Production is a bit field in table1 of a SQL database. Any help for > solving this is greatly appreciated. > > Thanks, > Khai
Re: How to do filtering
Author: Khai Trinh
Date: Wed, 20 Sep 2006 15:49
Date: Wed, 20 Sep 2006 15:49
122 lines
4844 bytes
4844 bytes
Thank you Bob and Viatcheslav for your help, it did the job!
My program is also using the BDE TQuery in codes like below:
//Insert record to first table;
Query1->Active = false;
Query1->ParamByName("MISSILE_SN")->AsString = MslName;
Query1->Active = true;
Query1->Insert();
Query1->FieldByName("MISSILE_SN")->AssignValue(MslName);
Query1->FieldByName("USER_NAME")->AssignValue(UserName);
Query1->Post();
// Insert record to second table
Query2->Active = false;
Query2->ParamByName("MISSILE_SN")->AsString = MslName;
Query2->Active = true;
Query2->Insert();
Query2->FieldByName("MISSILE_SN")->AssignValue(MslName);
Query2->FieldByName("SERIALNO")->AssignValue(sn);
Query2->FieldByName("CSF_DATE")->AssignValue(testdate);
Query2->Post();
// Insert record to third table
Query3->Active = false;
Query3->ParamByName("MISSILE_SN")->AsString = MslName;
Query3->Active = true;
Query3->Insert();
Query3->FieldByName("MISSILE_SN")->AssignValue(MslName);
Query3->FieldByName("POSITION")->Value = i;
Query3->Post();
DisplayStatus("Apply initial updates");
TDBDataSet *Tables[3];
Tables[0] = Query1;
Tables[1] = Query2;
Tables[2] = Query3;
Query1->Database->ApplyUpdates(Tables,2);
The last line in this code is the one that actually applies the
updates to the three tables at once and roll everything back if
something goes wrong. I need to replace the TQuery controls
with ADOQuery controls. How can I do this?
I could do something similar to this below:
//Insert record to first table;
ADOQuery1->Active = false;
ADOQuery1->ParamByName("MISSILE_SN")->AsString = MslName;
ADOQuery1->Active = true;
ADOQuery1->Insert();
ADOQuery1->FieldByName("MISSILE_SN")->AssignValue(MslName);
ADOQuery1->FieldByName("USER_NAME")->AssignValue(UserName);
ADOQuery1->Post();
// Insert record to second table
ADOQuery2->Active = false;
ADOQuery2->ParamByName("MISSILE_SN")->AsString = MslName;
ADOQuery2->Active = true;
ADOQuery2->Insert();
ADOQuery2->FieldByName("MISSILE_SN")->AssignValue(MslName);
ADOQuery2->FieldByName("SERIALNO")->AssignValue(sn);
ADOQuery2->FieldByName("CSF_DATE")->AssignValue(testdate);
ADOQuery2->Post();
// Insert record to third table
ADOQuery3->Active = false;
ADOQuery3->ParamByName("MISSILE_SN")->AsString = MslName;
ADOQuery3->Active = true;
ADOQuery3->Insert();
ADOQuery3->FieldByName("MISSILE_SN")->AssignValue(MslName);
ADOQuery3->FieldByName("POSITION")->Value = i;
ADOQuery3->Post();
DisplayStatus("Apply initial updates");
//TDBDataSet *Tables[3];
//Tables[0] = Query1;
//Tables[1] = Query2;
//Tables[2] = Query3;
//Query1->Database->ApplyUpdates(Tables,2);
But this would update each table one at a time which is not what
I really want.
Thanks again,
Khai
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote:
>In addition, if you filter using column Production, it should be in select,
>i.e. x1 or x2 should be Production.
>
>//------------------------------------------
>Regards,
>Vassiliev V. V.
>http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
>ADO.Net
>http://www.oledbdirect.com - The fastest way to access MS SQL Server,
>MS Jet (Access) and Interbase (through OLEDB)
>
>
>"Khai Trinh" <khai.trinh1@navy.mil> �������/�������� � �������� ���������:
>news:4510780b$1@newsgroups.borland.com...
>>
>> Hi,
>>
>> Here's part of my code:
>> line 1. ADOQuery1->SQL->Text = "select x1,x2 from table1";
>> line 2. ADOQuery1->Filtered = true;
>> line 3. ADOQuery1->Filter = "Production";
>> line 4. ADOQuery1->Active = true;
>>
>> At line 4, I get the error below:
>> "Arguments are of the wrong type, are out of acceptable range, or are in
>> conflict with one another."
>>
>> Production is a bit field in table1 of a SQL database. Any help for
>> solving this is greatly appreciated.
>>
>> Thanks,
>> Khai
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads