Board index » delphi » access again and again....

access again and again....

hello there....

i have a general question because of cennecting to an access table via
delphi 5
afther a hard way of trying to figure out how to connect to an access
table (it works but still don't know why) i got it....

well let me show how i did it work and maybe you can answer me perhaps
to get the problem to be fixed...

i did an alias via bde then in that alias i changed to the odbc and did
an alias? again...
from the bde i connected to the alias in the odbc and that's it?

i could connect via delphi to my alias and opened my access 97 table and
shows the records... i don't know if that way is the right one the only
thing i know is that it works but my question is how do i make an
automation for that because of my application...? i mean my application
works fine on my pc but on my work it fails because there's no alias...
is there a way to create an alias because of my application in the
bde/odbc if there doesn't exist one? i don't know how can somebody help
me it would be great to get my brain work an understanding in that point
of programming thank you for your patience.....regards


Re:access again and again....

You can create a BDE alias on another machine when you install your program
with InstallShield Express. You can also create a BDE alias from a Delphi
program using the AddAlias and SaveConfigFile methods of TSession.

Bill Todd (TeamB)
(Questions received via email cannot be answered.)

Re:access again and again....

>is there a way to create an alias because of my application in the
>bde/odbc if there doesn't exist one

You can create an Alias  see Tsession.addAlias or use a Tdatabase instead of an
Alias.  However for ODBC Aliases you will need to have a DSN to connect to.
BDE does not allow you to change the database your DSN points to.

Brian Bushay (TeamB)

Re:access again and again....

"SARGE!" <> wrote in message

Aside from Bill and Brian's suggestions, you also don't necessarily have to
create an alias at all. I use Access table all the time and I never create
an alias. I let the TDatabase do the work for me. In the params section of
the TDatabase, add

Database Name=c:\datadir\database.mdb

substituting the directory and database name for you location. You can also
change this at runtime if the database moves or is mapped to a different
drive on another machine. I use this technique succesfully in all my
installations. Each user can then set his/her mappings the way they like
them. In the program setup dialog(s), I alway put the location of the data
as an option for them to change and save this to an INI file for that
machine. The program reads this value in at start, sets up the TDatabase and
connects. If there is a problem, the user is notified and the setup can be
run automatically for them to locate the database.

I am not sure because I don't use ODBC, but I believe that you can build an
ODBC connect string on the fly and apply it in a different manner but I
would have to try some things to work out exactly how.

Hope this helps....

Other Threads