O
oldwolf201
Unregistered / Unconfirmed
GUEST, unregistred user!
我用C++BUILDER写的一个用户注册界面。其中用LISTVIEW来显示当前数据库中所有的用户。当添加或删除用户以后LISTVIEW应该得到相应的刷新。但我的程序无法实现刷新,请指点。程序如下:
void __fastcall TForm1::ListAcctTabSheetShow(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from USER_INFO");
ADOQuery1->Open();
StatusBar1->Panels->Items[2]->Text = IntToStr(ADOQuery1->RecordCount);
ListView1->Items->Clear();
TListItem *pItem;
ADOTable1->Open();
ADOTable1->First();
do
{
pItem = ListView1->Items->Add();
pItem->Caption = ADOTable1->FieldByName("USERCODE")->AsString;
pItem->SubItems->Add(ADOTable1->FieldByName("USERNAME")->AsString);
pItem->SubItems->Add("");
pItem->ImageIndex = 0;
ADOTable1->Next();
}
while(!(ADOTable1->Eof));
}
请问错在那里,在线等,急用。
void __fastcall TForm1::ListAcctTabSheetShow(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from USER_INFO");
ADOQuery1->Open();
StatusBar1->Panels->Items[2]->Text = IntToStr(ADOQuery1->RecordCount);
ListView1->Items->Clear();
TListItem *pItem;
ADOTable1->Open();
ADOTable1->First();
do
{
pItem = ListView1->Items->Add();
pItem->Caption = ADOTable1->FieldByName("USERCODE")->AsString;
pItem->SubItems->Add(ADOTable1->FieldByName("USERNAME")->AsString);
pItem->SubItems->Add("");
pItem->ImageIndex = 0;
ADOTable1->Next();
}
while(!(ADOTable1->Eof));
}
请问错在那里,在线等,急用。