Solved

Delphi query Error

Posted on 2013-01-05
3
572 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:khaledsalem
3 Comments
 
LVL 25

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:khaledsalem
ID: 38746851
Thank you very much for the second point
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now