Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create an ODBC Entry

Status
Not open for further replies.

tseh

Programmer
Joined
Jan 13, 2000
Messages
64
Location
CA
How can I create an ODBC Entry in code for the DSN that I use for Data Environment using code. (We are using a SQL Server)

Thanks
 
You don't need to write any code if you are using a DSN for your connection via the Data Environment. You go to Project...Add Data Environment then it prompts you for a connection. Just click the Connection tab and select a DSN name you already set up. Just make sure the SQL Server is running. But if you feel so inclined to write the code here is an example:

ConnectionObjectname.ConnectionString = "PROVIDER = MSDASQL.1;Data Source = DSNName; Initial Catalog = Databasename; UID = sa; PWD=;"

Substitute your password for the SA systems administrator account if you changed it.
 
Will this add a DSN when I install this program to a workstation without the DSN already defined?
 
No, when you install the programme, copy the file dsn (make it a file dsn, it's easier) to c:\program files\odbc\data sources.

I don't know if is is possible to have these files somewhere else and the whole thing working. I don't know if there is something in the registry giving thelocation of the dsns's. Peter Meachem
peter@accuflight.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top