Solved

Delphi query Error

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

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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