?
Solved

litltle help on designing a login network

Posted on 2001-06-04
6
Medium Priority
?
202 Views
Last Modified: 2010-04-06
hi

am trying to design a login network an I have tried to use gotokey technique but am having a little problem which am hoping you can help. I am using Delphi V4 Paradox 7 and I have tried to use the following code....

with Table1 do
begin
Table1.Open;
     with Table1 do begin
          SetKey;
          FieldByName('UserName').AsString:=              
          UserComboBox.Text;
          FieldByName('Password').AsString:=
          PasswordEdit.Text;
          GotoKey;
          if not Table1.GotoKey then begin
          MessageDlg('User Not Found! Please Check and
                     Try Again.', mtError, [mbOK], 0);
         
          end else
          if Table1.GotoKey then begin
             if FieldByName('User').AsString = 'Manager'  
             then
             button1.enabled:=true;
             end else
          if Table1.GotoKey then begin
             if FieldByName('User').AsString = 'Sales
             Staff' then
             button2.enabled:=true;
          end else

          if Table1.GotoKey then begin
             if FieldByName('User').AsString = 'Stock
             Controller' then                
             button3.enabled:=true;
          end;
end;


am using the DBCombobox and DBEdit to store password and username and then am using the TComboBox and TEdit when searching for record.

can someone tell me what am i doing wrong or is there another way of doing this.

Thank you
0
Comment
Question by:Delphiboy
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:martin_g
ID: 6152481
And the problem is?
0
 

Author Comment

by:Delphiboy
ID: 6152746
I got this error message when I tired to test this code. For instance if I select Manager from TComboBox and enter password in TEditbox button1 should be enabled, but I have this error message...

Project Project1.exe raised exception class EDatabaseError with message ?Field Password? is not indexe and cannot be modified?.



What am I doing wrong?

0
 
LVL 1

Accepted Solution

by:
martin_g earned 200 total points
ID: 6153031
You need to index the Password field.  GotoKey uses indexed fields only.
0
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!

 

Author Comment

by:Delphiboy
ID: 6153274
Am sorry what do you mean, am not that good in Delphi
0
 
LVL 1

Expert Comment

by:martin_g
ID: 6155058
I mean that you need to crate an index on the "Password" field to use SetKey.  You can create one by: Closing Delphi and then opening the table in Database Desktop (DBD.exe) File|Open|Table. With the table open, go to Table|Restructure.  Click on the Define button under Indexes.  Double click on the Password field to create an index. Check 'Maintained'. Click OK and then give it a name such as 'idxPassword'. You should now see the new index added to the Indexes list.  Close DBD.
You should be able to compile the program okay.  

0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 9285827
Delphiboy,
No comment has been added lately (822 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to martin_g http:#6155058

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

DragonSlayer
EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
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 Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

839 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