?
Solved

Delphi query Error

Posted on 2013-01-05
3
Medium Priority
?
596 Views
Last Modified: 2013-01-05
Hi all:
I've an strange error message in a payroll system. when i call some procedure or function to return specific value. there is a message "Query1 EmpName Not Found",
i am clear all fields before this function, i am using the same query to other functions and procedure but also clear  it before start.


query error msg
piece of code
0
Comment
Question by:khaled salem
[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 Comments
 
LVL 27

Accepted Solution

by:
Sinisa Vuk earned 2000 total points
ID: 38746809
When exception pop up? On Open query? If you use this query for other purpose, maybe you link it with some db component like dbedit or dbcombobox on form where you use EmpName field. For just getting data  from db use separate query and for visual db components use another.

Second: I've noticed that you use for loop. Better approach is to use while loop like:
dm.query1.First;
while not dm.query1.eof do
begin
  combo1.Items.Add(....);
   ...
  dm.query1.Next;
end;

Open in new window

0
 
LVL 7

Expert Comment

by:armchang
ID: 38746815
The code you've checked is only one part. The other part is you need to update the persistent fields or the initial query inside the DM.Query1. You can do this by going the to the DM form window, select the Query1 component then go to properties window and open the SQL property to update and remove the field in the SQL string.
0
 

Author Closing Comment

by:khaled salem
ID: 38746851
Thank you very much for the second point
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

777 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