Solved

ADO recordset problem

Posted on 2001-06-07
4
514 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi: how to implement a User Shortcut mapper? 1 110
Delphi 2 60
How to renew a Delphi rad-studio licence? 5 65
Delphi: making a BW image transparent 10 38
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 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