|
-
Mar 26th, 2003, 01:43 PM
#1
Thread Starter
Member
how to put db connection in my ini
I have just made an ini file called "irs.ini"
I have stored this in my c:\ directory.
it looks like this:
[connectionfile]
dbconstring = c;\irs\irs1.mdb
Now I want to get the value from the ini and set it to a variable in my VB project so my database can hook up via the value in the ini file. It is so the host machine for my application can access the db as wel las the client machines.
Anyone offer some help?
-
Mar 26th, 2003, 01:51 PM
#2
Fanatic Member
i'm sure you will get an answer about how to save and retrieve from ini's. however you may use 2 or 3 other methods that are more 'contemporary':
(A) save the database path in the registry, instead of saving in an ini. use the standard GetSetting() and SaveSetting() functions for that
OR (B) save a connection string instead of the database filename
OR (C) use a fixed-name DSN file that you would distribute with your application
there are 2 reasons why i leave my work unfinished:
(1) i'm getting old.
-
Mar 26th, 2003, 02:00 PM
#3
Fanatic Member
Check here there should be a function there called ReadINI. It will show you how you can put the value of a specific key whereever you need to put it.
-
Mar 26th, 2003, 02:27 PM
#4
Frenzied Member
Originally posted by radum
i'm sure you will get an answer about how to save and retrieve from ini's. however you may use 2 or 3 other methods that are more 'contemporary'...
Contemporary doesn't necessary means BETTER. Registry is the worst place to store critical information such DB related info as it (registry) can be very easily overwritten on every system restart from LAN (this method has been used by many corps where security is strictly enforced), besides most of the users don't even have permissions to access registry at all. So, I'll let you decide what's better: contemporary or SAFE.
-
Mar 26th, 2003, 02:32 PM
#5
PowerPoster
Well
How I do it :
[CONNECTIONS]
'A = MICROSOFT ACCESS DATABASE
'B = MICROSOFT SQL DATABASE
'C = ORACLE DATABASE
A= Provider=Microsoft.Jet.OLEDB.4.0; Data Source=
B=
C=
CONNTYPE = A
This way I can change the connection type and the type of database in my ini file...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 26th, 2003, 02:47 PM
#6
Fanatic Member
Originally posted by McGenius
Contemporary doesn't necessary means BETTER. Registry is the worst place to store critical information such DB related info as it (registry) can be very easily overwritten on every system restart from LAN (this method has been used by many corps where security is strictly enforced), besides most of the users don't even have permissions to access registry at all. So, I'll let you decide what's better: contemporary or SAFE.
agreed, and dsn files can be used in this situation. however changing that registry entry upon network login or some other events may be exactly the desired effect, especially if the database keeps moving around. 'better' or 'worse' qualifiers is what i was trying to avoid, by naming them 'contemporary'.
there are 2 reasons why i leave my work unfinished:
(1) i'm getting old.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|