Solved

Login to ACCESS-db...

Posted on 2000-03-07
9
185 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:Erik N
Comment Utility
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
Comment Utility
Aubs was first ..
0
 
LVL 2

Expert Comment

by:aubs
Comment Utility
For a change...
0
 

Author Comment

by:Erik N
Comment Utility
OK aubs... Propose....
0
 
LVL 2

Accepted Solution

by:
aubs earned 100 total points
Comment Utility
Thanks!

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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