Solved

Delphi query Error

Posted on 2013-01-05
3
589 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 500 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

Technology Partners: 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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

724 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