Article View: borland.public.cppbuilder.database.multi-tier
Article #405Blank DB Grid Showing
From: Jerri Chiu
Date: Mon, 03 Jun 2002 22:57
Date: Mon, 03 Jun 2002 22:57
57 lines
3174 bytes
3174 bytes
Hi everybody,
This is a rather weird problem, I'll try to give as much info
as possible to produce this:
I am using a TDBGrid component to display the results from a
TQuery component. On the form, I also have an 'Update' button,
which takes user input and updates that record. Sometimes the
user changes the info in the input box without hitting the
update button, so I would give a message to ask if he wants to
save the changes, if yes, I would call the same function that
'Update' button calls (btnUpdateClick). If use clicks 'Update'
to update, all rows came back displaying fine, however, if he
uses the 2nd approach to update, the grid comes back blank..!
this has something to do with my overriding the following
function. I also have a 'Refresh' button, after it came back
as blank, if I click 'Refresh', then it's alright. 'Refresh'
just goes to the database and gets the latest data. the
'Update' function also calls the btnRefreshClick event at the
end, however not doing the trick.
Thanks for any suggestions..
Jerri
==============================================================
void __fastcall TfrmEMEvents::dbgDisplayDrawColumnCell(TObject
*Sender, const TRect &Rect, int DataCol, TColumn *Column,
TGridDrawState State)
{
//qDisplay is my TQuery component
String str1=qDisplay->FieldByName("status")->AsString;
if( State.Contains( Grids::gdSelected ) )
{
dbgDisplay->Canvas->Font->Color = clWhite;
dbgDisplay->Canvas->Brush->Color =
clHighlight; }
else
{
dbgDisplay->Canvas->Font->Color = clRed;
dbgDisplay->Canvas->Brush->Color = clWindow;
if (str1=="COMPLETED")
dbgDisplay->Canvas->Font->Color = clGreen;
else if (str1=="ERROR")
dbgDisplay->Canvas->Font->Color = clRed;
else if (str1=="HOLD")
dbgDisplay->Canvas->Font->Color = clBlue;
else
dbgDisplay->Canvas->Font->Color = clBlack;
}
dbgDisplay->DefaultDrawDataCell(
Rect,
dbgDisplay->Fields[DataCol],
State);
}
Technical Details
Message-ID:
<3cfbf44d$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!isdnet!newsfeed.icl.net!colt.net!newspeer.clara.net!news.clara.net!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news.uni-stuttgart.de!nntp.cs.uni-magdeburg.de!PeerFeed.KWeb.on.ca!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,6670483b74ff7cc1,start X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2002-06-03 16:03:06 PST From: "Jerri Chiu" <jerrichiu@yahoo.com> Sender: "Jerri Chiu" <jerrichiu@yahoo.com> Reply-To: "Jerri Chiu" <jerrichiu@yahoo.com> Subject: Blank DB Grid Showing Newsgroups: borland.public.cppbuilder.database.multi-tier X-User-Info: 199.72.137.162 199.72.137.162 NNTP-Posting-Host: 207.105.83.65 Message-ID: <3cfbf44d$1_2@dnews> Date: 3 Jun 2002 15:57:17 -0700 X-Trace: dnews 1023145037 207.105.83.65 (3 Jun 2002 15:57:17 -0700) Lines: 59 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!isdnet!newsfeed.icl.net!colt.net!newspeer.clara.net!news.clara.net!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news.uni-stuttgart.de!nntp.cs.uni-magdeburg.de!PeerFeed.KWeb.on.ca!dnews