Solved

Login to ACCESS-db...

Posted on 2000-03-07
9
186 Views
Last Modified: 2010-05-19
Need some advice on how to avoid the login-prompt when connecting to an access-database. I use Delphi 4 Pro. Using ODBC-alias pointing at the db..

Thanx !
/Erik N
0
Comment
Question by:Erik N
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:aubs
ID: 2591634
Hi Erik

If you connect to a database via the TDatabase component, you can set the TDatabase component LoginPrompt property to false.
0
 
LVL 2

Expert Comment

by:aubs
ID: 2591652
Sorry, I should have explained better.

Drop a TDatabase component (from the Data Access tab) on a form and set the alias to the one you are already using.

Set DatabaseName to some arbitrary new alias name, like 'Accesstest'.

Set the loginprompt property to False.

Set the aliases of all other data aware components on the form to this new alias 'AccessTest'.

Regards Aubs
0
 
LVL 17

Expert Comment

by:geobul
ID: 2591772
Hi Erik,

You can write an OnLogin event handler on your TDatabase component as follows:

procedure TForm1.MyDBLogin(Database: TDatabase; LoginParams: TStrings);
begin
  LoginParams.Values['USER NAME'] := 'admin';
  LoginParams.Values['PASSWORD']  := '';
end;

Set TDatabase component properties LoginPrompt to false and KeepConnection to true.

Regards, Geo
0
 
LVL 17

Expert Comment

by:inthe
ID: 2592409
i did this for someone else ,it basically backs up what aubs said:

Odbc:

1:   Open Control Panel, and then select ODBC DataSources (32bit) .
2:   When the Data Source Administrator appears, Click Add.
3:   find the one that says  Microsoft Access Driver (*.mdb)
     click it and click finish.
4:   A dialog will popup called ODBC Microsoft Access Setup
5:   in "data source name" edit box well call it "MyAccess"
6:   description well say is "tesing msaccess connection".
7:   click select and find your .mdb file click ok to select it.
8:   click "advanced" and make sure login name and password are blank.
9:   close advanced.
10:  close microsoft access setup dialog
11:  close the  Data Source Administrator.


delphi:

1:  start or restart delphi if its already running.
2:  start a new project
3:  drop a ttable,tdbgrid,tdatasource,tdatabase on form.

    in object inspector:

4:  datasource1 dataset : table1
5:  dbgrid datasource   : datasource1
6:  database1 aliasname : MyAccess  
7:  database1 databasename : MyAccessDB //tyope some name
8:  database1 loginprompt : false
9:  table1 databasename : MyAccessDB  //is now selectable
10: table1 tablename : select a table
11: database1 connected : true
12: table1 active : true

and viola table should appear with no login prompt
set loginprompt to true and you get the prompt or set to
false and get no prompt.

hope this helps someone somewhere

Regards Barry
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Erik N
ID: 2600157
All these worked fine except setting the login params using the ODBC-administrator. My params in the ODBC-administrator is already blanked..

Who want some points ?

/Erik N
0
 
LVL 17

Expert Comment

by:inthe
ID: 2600753
Aubs was first ..
0
 
LVL 2

Expert Comment

by:aubs
ID: 2601030
For a change...
0
 

Author Comment

by:Erik N
ID: 2605144
OK aubs... Propose....
0
 
LVL 2

Accepted Solution

by:
aubs earned 100 total points
ID: 2611686
Thanks!

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

17 Experts available now in Live!

Get 1:1 Help Now