PDA

Click to See Complete Forum and Search --> : Setting up DSN or PDW HELP


no1biscuit
Nov 17th, 2000, 12:07 AM
I am haveing a problem with my Crystal report page that requires a DSN. When I use the Package and Deployment wizard it does not create my DSN for me. How do I set one up in code so I don't have to create one on every machine?
Thanks
Thom

Skeen
Nov 17th, 2000, 02:27 AM
Yeah,

DSN is the data source name and so its what you've called your database. Use it in a connection string like this:

Set cnOBJECT = CreateObject ( "ADODB.Connection" )
cnOBJECT.ConnectionString = " Provider=MSDAORA.1; " _
& " DSN=Databasename; " _
& " UID=Username; " _
& " PWD=Password;"
cnOBJECT.open

cnOBJECT is the connection object. You assign the connection string to this with infomation shown above,
Provider - specific to the type of database you are using,
MSDAORA.1 is for oracle databases, but a general one that seems to work on most is MSDASQL.
DSN - Name of database and then the user/password you've set up as administrative level on your database.
Then open the connection.
Use this at the beginnig of all your scripts, oh yeah at the end of the script its good practice to close down the connection:

cnOBJECT.close

Hope this helps

Skeen

no1biscuit
Nov 17th, 2000, 12:47 PM
Crystal reports is using a dao thus I want to create a ODBC connection with the dsn name as "Progressive". I want to this when the application starts so when I install this on another machine it will create the connection.
Thanks
Thom Morrow

monte96
Nov 17th, 2000, 01:21 PM
Check out this from MSDN (http://msdn.microsoft.com/library/devprods/vs6/vstudio/vdbref/dvhowcreatingfiledsn.htm).