Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error Message : Query  '<field name>' is not found

Posted on 2002-07-11
6
Medium Priority
?
2,372 Views
Last Modified: 2007-12-19
Dear Advisor !

There is a TADOQuery on TFrom. I use TADOQuery to get data  in some cases. Like that

ADOQuery.Active := False
ADOQuery.SQL.Clear
ADOQuery.SQL.Add('<SQL Statemen>')
ADOQuery.Parameters.ParamValues['<filed name>'] := <value> ;
ADOQuery.Open

TEdit1.Text := ADOQuery.FieldValues[<Field 1>']
TEdit2.Text := ADOQuery.FieldValues[<Field 2>']   {Line is marked error}
TEdit3.Text := ADOQuery.FieldValues[<Field 3>']


There is no error . But  sometime, when i assign value to TEdit, it makes a error. Sometime, ADOQuery remembers the old SQL Statement ?

Query  '<field name>' is not found

Althought, i use "select * from" in SQL Statement, or indicate each fields

Thanks for all consider
0
Comment
Question by:NamCit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 44

Accepted Solution

by:
CrazyOne earned 60 total points
ID: 7149237
I don't know if this will help with your problem but instead of using the FieldValues property try doing this instead

ADOQuery.FieldByName('<Field 1>').AsString;

FieldValues is a variant and as such the system needs to figure out what the type is of the variant and convert it, which causes more overhead and slows down the process. If you use FieldValues a lot in a project and then replace it with FieldByName you would probably notice the improvement in performance.

Also as a personal preference I instead of using
ADOQuery.Active := False

I use
ADOQuery.Close;

I don't think it matters one way or the other but for me it is easier to do and read. :>)
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7149252
Please provide a few examples of your SQL statement especially on the one(s) when the error ocurrs. I suspect that is where the problem is.
0
 

Author Comment

by:NamCit
ID: 7153157

Dear Sir !

I have modified muy code so much, so now i dont get thet error again.

i will use FieldByName like your comment.


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:NamCit
ID: 7153179

Thanks so much.

I hope to receive more your consider in future
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 7153201
:>)
0
 

Author Comment

by:NamCit
ID: 7153313

I hhave a new question in forum

{
I use Delphi 5.0

TDBGRID is moved (be wriggled), when i retrieve new data from Table.

I also used InputForm.OrderTable.DisableConTrol. But it is not effcted.
}
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

598 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