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
Solved

Login to ACCESS-db...

Posted on 2000-03-07
9
188 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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