Board index » cppbuilder » TADOQuery->RecNo issues ?

TADOQuery->RecNo issues ?


2007-12-11 08:25:58 PM
cppbuilder112
Hello,
I need to have row number in grid and do it:
void __fastcall TFormBrowse::ADOQOnCalcFields(TDataSet *DataSet)
{
DataSet->FieldValues["RowNumber"] = DataSet->RecNo;
}
But for first and last record that show "-1" !
How can solve this problem ?
Best Regards,
M.T
 
 

Re:TADOQuery->RecNo issues ?

"Sasan" < XXXX@XXXXX.COM >wrote:
Quote
Hello,

I need to have row number in grid and do it:

void __fastcall TFormBrowse::ADOQOnCalcFields(TDataSet *DataSet)
{
DataSet->FieldValues["RowNumber"] = DataSet->RecNo;
}

But for first and last record that show "-1" !
How can solve this problem ?
Stop reading past bof/eof.
When reading forward, add a check to see if the DataSet-RecNo
is less than the DataSet->RecordCount.
When Reading backwards, check to see that DataSet->RecNo is
greater than 2.
~ JD
 

Re:TADOQuery->RecNo issues ?

Hello,
Thanks, can explain your situation in code ?
Regards,
M.T
"JD" < XXXX@XXXXX.COM >wrote in message
Quote

"Sasan" < XXXX@XXXXX.COM >wrote:
>Hello,
>
>I need to have row number in grid and do it:
>
>void __fastcall TFormBrowse::ADOQOnCalcFields(TDataSet *DataSet)
>{
>DataSet->FieldValues["RowNumber"] = DataSet->RecNo;
>}
>
>But for first and last record that show "-1" !
>How can solve this problem ?

Stop reading past bof/eof.

When reading forward, add a check to see if the DataSet-RecNo
is less than the DataSet->RecordCount.

When Reading backwards, check to see that DataSet->RecNo is
greater than 2.

~ JD

 

{smallsort}