Solved

litltle help on designing a login network

Posted on 2001-06-04
6
197 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
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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to call a form that is in a DLL  from an application? 13 88
Delphi Form ownership 4 127
Dev express lookupcombo 3 47
how to change, disabled button color FMX ? 1 51
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…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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