Solved

litltle help on designing a login network

Posted on 2001-06-04
6
194 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
Comment Utility
And the problem is?
0
 

Author Comment

by:Delphiboy
Comment Utility
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
Comment Utility
You need to index the Password field.  GotoKey uses indexed fields only.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

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

Expert Comment

by:martin_g
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

16 Experts available now in Live!

Get 1:1 Help Now