Article View: borland.public.cppbuilder.database.ado
Article #5280question about query and while
From: AMG
Date: Thu, 14 Jun 2001 06:31
Date: Thu, 14 Jun 2001 06:31
78 lines
3812 bytes
3812 bytes
Haiii..
I have problem c++ builder...
I have progress database and my program is C++ builder...
I have run my program with requestlive true or false, and it still error.
when I run this procedure ...the program give error message. it say
"EDBEngineError with message 'Key violation'.
This error arise when recordcount for qry_os_trades_all = 50 and after that
error.
My sql command not wrong and i sure about that, but if my sql command wrong
will arise a different error command.
i need help...i looking for answer.....
my procedure are :
void __fastcall TfrmReceiveAging::saya()
{
AnsiString sql, temp_currcode,temp_dealercd,temp_clacno;
TQuery *qry_os_trades_all = new TQuery(NULL);
qry_os_trades_all->DatabaseName = glb_database ;
qry_os_trades_all->SQL->Clear();
qry_os_trades_all->RequestLive = true;
sql = "select * from pub.os_trades where company_id ='"+ glb_CompanyID
+"' and branch_id = '"+ glb_BranchID +"' and dealercd between 'b 004' and 'b
007' and cnbalamt > 0 order by currcode,dealercd,clacno ";
qry_os_trades_all->SQL->Add(sql);
qry_os_trades_all->Prepare();
qry_os_trades_all->Open();
while (!qry_os_trades_all->Eof)
{
TQuery *qry_currency = new TQuery(NULL);
qry_currency->DatabaseName = glb_database ;
qry_currency->SQL->Clear();
qry_currency->RequestLive = true;
qry_currency->SQL->Add("select descriptn from pub.currency where
currcode= '"+ qry_os_trades_all->FieldByName("currcode")->AsString +"'");
qry_currency->Prepare();
qry_currency->Open();
temp_currcode =
qry_os_trades_all->FieldByName("currcode")->AsString;
while ( temp_currcode ==
qry_os_trades_all->FieldByName("currcode")->AsString &&
!qry_os_trades_all->Eof)
{
temp_dealercd =
qry_os_trades_all->FieldByName("dealercd")->AsString;
while (temp_dealercd ==
qry_os_trades_all->FieldByName("dealercd")->AsString && temp_currcode ==
qry_os_trades_all->FieldByName("currcode")->AsString &&
!qry_os_trades_all->Eof)
{
temp_clacno =
qry_os_trades_all->FieldByName("clacno")->AsString ;
while (temp_clacno ==
qry_os_trades_all->FieldByName("clacno")->AsString && temp_dealercd ==
qry_os_trades_all->FieldByName("dealercd")->AsString && temp_currcode ==
qry_os_trades_all->FieldByName("currcode")->AsString &&
!qry_os_trades_all->Eof)
{
TQuery *qryAryanto = new TQuery(NULL);
qryAryanto->DatabaseName = glb_database ;
qryAryanto->SQL->Clear();
qryAryanto->RequestLive = true;
qryAryanto->SQL->Add("SELECT * FROM pub.trade_acct");
qryAryanto->Prepare();
qryAryanto->Open();
qry_os_trades_all->Next();
}
}
}
}
}
Technical Details
Message-ID:
<3b285a5b_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,6d832fb9f18b6143,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-06-13 23:39:25 PST From: "AMG" <amg_land@hotmail.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: question about query and while Date: Thu, 14 Jun 2001 13:31:23 +0700 Lines: 80 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 202.95.130.226 Message-ID: <3b285a5b_2@dnews> X-Trace: dnews 992500315 202.95.130.226 (13 Jun 2001 23:31:55 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews