Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Protected Tables

Status
Not open for further replies.

di52517

MIS
Joined
Dec 30, 2001
Messages
2
Location
US
Good Evening:

I hope that someone can help me. I have a password paradox table, that I used the example of the OnPassword example in the CBuilder 5 help file. When I first add the routines, and put the password in the TForm1::Password function call, compile it, and test it it works OK (doesn't prompt for the password). Then to test it further, I change the password to the WRONG password, compile the program, and it prompts with the password dialog box from Paradox, which I expected. I then would change the password back to the good one, compile it, and it still prompts me. I know the case is OK, because for the testing I use the password of 12345. I would delete ALL of the OBJ files, and do a 100% build of the program again, and it still prompts me for the password, although it's correct.

I then would delete the Password function (and the associated declarations and the "Session->OnPassword = Password;" in the TForm1::FormCreate(TObject *Sender), compile the program and it works OK on non-protected tables. I then add the functions/declarations back in, compile it, and it access the table without prompting. If I then change the password again to a wrong one and back to the correct one, compiling the program completly between each, the problems start again.

Can anyone help?
 
I resolved the problem:

Drop the TDatabase, TTable and TDataSource on the form, don’t fill in the table name property of the TTable.

Modules in the program:

void __fastcall TForm1::Password(TObject *Sender, bool &Continue)
{
AnsiString PassWrd;
PassWrd = "12345";
Session->AddPassword(PassWrd);
Continue = (PassWrd > "");
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Session->OnPassword = Password;
table1->Active = false;
Database1->Connected = false;
Database1->AliasName = "PEKB";
Database1->DatabaseName = "MyDatabase";
table1->DatabaseName = Database1->DatabaseName;
table1->TableName = "KB_PEKB.DB";
Database1->Connected = false; // yes false, true prompts
table1->Active = true;
table1->Open();
Application->OnIdle = AppIdle;
}

Within the class declaration for the form:

public:
__fastcall TForm1(TComponent* Owner);
void __fastcall AppIdle(TObject *Sender, bool &Done);
void __fastcall Password(TObject *Sender, bool &Continue);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top