Solved

ADO recordset problem

Posted on 2001-06-07
4
518 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
ID: 6165691
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
ID: 6177305
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
ID: 6177945
There is no other solution......
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 9285698
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 166
Delphi Form ownership 4 113
Run video youtube webbrowse 10 65
Tvertscrollbox like a whatsapp layout delete messages 1 24
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

829 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