Solved

litltle help on designing a login network

Posted on 2001-06-04
6
198 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
[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
  • 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 50 total points
ID: 6153031
You need to index the Password field.  GotoKey uses indexed fields only.
0
Technology Partners: 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

Industry Leaders: 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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

705 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