Re: Problem with OnCalcFields() Event.



tanaskovskij@xxxxxxxxxxx wrote:
> Parameters:
> Delphi6.0, DB- MSSQL, ADO Connection;
>
> J have table with > 3000000 records and ADODataSet (SELECT * FROM
> PTABLE WHERE LONG='Parameter') that return recordsets with 1..200
> records. The result J display in DBGrid.
> J need to have numbers on every record in DBGrid.
> My aproach was to make calculated field and write onCalcField event
> where ADODataSet.FieldByName('RecordNum').Value:=ADODataSet.RecNo.
> Since RecNo is documented as function that returns the actual position
> in resulting record set. J have result -1 for first record and OK for
> others, but when J add new record and requery, the numbers are also
> not well.
> Anyone has same problem,

There is no such thing as a RecNo before you have posted the record into the
database.
I wouldn't use the term RecNo for anything when working with a database
application. It's not a very "database-like" term, and many db engines have
no notion about such a "measure"; If it's for uniquely identifying a record,
the normal method would be assigning an ID, or using the row identificator.

--
Bjørge


.



Relevant Pages

  • Re: Concurrency violation at update
    ... When you create a database that contains an auto-increment field, ... RecNo an auto-increment column and primary key, ... because you know that the auto-increment will fix it up correctly. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Class not registered
    ... > How can he only have Dao360.dll and be able to connect to the database and ... > then when he access the form containing the Data Control and DBGrid he has ...
    (microsoft.public.vb.database.ado)
  • Re: display the record number on dbgrid
    ... I hope that your database table includes ... I notice that TClientDataSet does provide a RecNo ... CDS RecNo is implemented and the calculated field ...
    (borland.public.delphi.database.ado)
  • Re: Refreshin form
    ... >> I have a main form with 2 dbgrid on it. ... >> the 2nd my main database. ... >> so when I move the smal form on the main form, the dbgrid refresh ... the small form close but I have a blanck square ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Refreshin form
    ... > I have a main form with 2 dbgrid on it. ... > the 2nd my main database. ... > so when I move the smal form on the main form, the dbgrid refresh ... the small form close but I have a blanck square ...
    (borland.public.delphi.thirdpartytools.general)