• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 603
  • Last Modified:

Delphi query Error

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
khaled salem
Asked:
khaled salem
1 Solution
 
Sinisa VukCommented:
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
 
armchangCommented:
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
 
khaled salemSoftware DeveloperAuthor Commented:
Thank you very much for the second point
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now