darknighter
asked on
how can i create a DSN in runtime
i'm work win a access 2000 db, and i just want to create the DSN with code, but before use de code i want con ask if the DSN exist, if the code exist i just use it, if it don't exist i create it
i'm developing an aplication that use Crytal Report 8.5, it suppouse that the user can install this aplication in any folder; therefore the aplication should detect the data sources that will use the crytal report
i'm developing an aplication that use Crytal Report 8.5, it suppouse that the user can install this aplication in any folder; therefore the aplication should detect the data sources that will use the crytal report
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not use a DSNless connection. All you have to do is create a connection string and open the connection object at runtime. In connection string you will pass all required parameters like data source name and username, passord etc. Here are two sites where you can find connection string for various databases:
http://www.connectionstrings.com
http://www.able-consulting.com/ADO_Conn.htm
http://www.connectionstrings.com
http://www.able-consulting.com/ADO_Conn.htm
Here is an example:
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.ConnectionString = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=c:\My Documents\myDatabase.mdb;"
cnn.Open
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.ConnectionString = "Provider=Microsoft.Jet.OL
cnn.Open
ASKER
emoreau, what is method for Access Database
ASKER
Not execute, the code is obsolete
???
DSNs are obsolete! Is it working or not?
DSNs are obsolete! Is it working or not?
Did you try DSNless connection as I mentioned above?
As far as I know, if the DSN doesn't exists it is created automatically.