Solved

Search problems HELP!!!!!!!

Posted on 1997-04-23
5
140 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Syntax Check Delphi Seattle IOS app without MAC ? 1 104
delphi prevent click fast 2 238
firemonkey keyboard covers the controls 1 37
How to make Sign in, using Clientdataset? 1 28
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

840 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