Solved

ADO recordset problem

Posted on 2001-06-07
4
508 Views
Last Modified: 2011-09-20
Previously I was looping thru TADOQuery object. I changed the code which now loops thru TADOQuery.recordset But now I have problem while passing the field into existing procedure

//// ----- Previous Code (which works fine)

Procedure ReadRecord(Fld : TField)

qr := TADOQuery.create(nil);
qr.sql.text := 'select * from table1'

with qr do
  while not eof
  begin
     ReadRecord(qr.fields[0]) ;
     Next ;
  end ;

//// ----- Latest Code

Procedure ReadRecord(Fld : TField)

qr := TADOQuery.create(nil);
qr.sql.text := 'select * from table1'

rs := qr.recordset ; {where as rs is type _Recordset}
with rs do
  while not eof
  begin
     ReadRecord(rs.fields[0]) ; //compile error here
     MoveNext ;
  end ;

I get compile error in readrecord line. I tried to typecast as Tfield but I got access violation. Pls help me to solve this problem

Thx in advance.

-Kiran
0
Comment
Question by:kiranmahale
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Epsylon earned 50 total points
Comment Utility
The problem is that the types are different. ADO does not know TField.

Try the following:
First put ADOInt in the uses clause. Second change the parameter type of ReadRecord from

Procedure ReadRecord(Fld : TField)

to

Procedure ReadRecord(Fld : Field)


But I don't think this is what you want.
0
 
LVL 1

Author Comment

by:kiranmahale
Comment Utility
I don't want to change the procedure at all. Instead of that if u any other solutions I will accept.
0
 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
There is no other solution......
0
 
LVL 14

Expert Comment

by:DragonSlayer
Comment Utility
kiranmahale,
No comment has been added lately (815 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to Epsylon http:#6165691

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

DragonSlayer
EE Cleanup Volunteer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now