Solved

Search problems HELP!!!!!!!

Posted on 1997-04-23
5
136 Views
Last Modified: 2010-04-04
I'm writing a program toenrool students in which I use a table called TaCursist where the indexfieldnames are Volgnr,naam,voornaam. If i try to make a search for a name he doesn't find him. I use the following code:
SetKey;
FieldByName('naam').AsString := Edit.text;
Gotokey;
How can I solve this. Please help me, it's urgent
Thanx, Tom
0
Comment
Question by:940216td
  • 3
5 Comments
 
LVL 1

Expert Comment

by:Heapster
ID: 1335633
I dont do much database programming at the moment, but dont you have to set up a query, and pass that to the database.
Im really not sure what the question is : are you trying to execute a search on a single field of your database?
0
 
LVL 2

Expert Comment

by:javiertb
ID: 1335634
You'll only find the name if the field 'naam' has an index, otherwise,you'll have to use an SQL component in this way:

SELECT * FROM TACURSIST WHERE NAAM= :PNAAM

where PNAAM is a parameter passed like this:

{Set param type in  TQuery properties}

Query1.Close;
Query1.Params[0].AsString:=Edit1.Text;
Query1.Open;
0
 

Author Comment

by:940216td
ID: 1335635
How do I put an index on field Naam?
HELP!!!!!!!!!!!!!!!!!!
0
 
LVL 2

Accepted Solution

by:
javiertb earned 100 total points
ID: 1335636
Just go to Database Desktop, open the table, reestructure, and then set the field you want to have an index. It's quite simple.
The index of a table is usually a code or similar and in your case you want to have an index at alumn name, so, it's up to you.
0
 
LVL 2

Expert Comment

by:javiertb
ID: 1335637
Are you using an SQL server? (Look at Delphi on line help for IndexFieldNames).
If not, just use the index field alumn number in the table and use IndexFiles and IndexName properties.

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

13 Experts available now in Live!

Get 1:1 Help Now