HOY
HOY

Reputation: 1007

ASP, DSN-Less connection, connection string syntax gives Data source name not found error

This is the error message

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/Ute/ute_class.inc, line 1357

This is my Ute.ASP code

Dim sDSN
sDSN = "Data Source=MYSERV0000\PSAPP01; Initial Catalog=LibraryDB; User Id=admsa; password=sa"

P.S: I am able to use the same string within my web.config, with .net 4.0

Upvotes: 0

Views: 1121

Answers (2)

HOY
HOY

Reputation: 1007

sDSN = "Provider=SQLNCLI;Server=SERVER\INSTANCE;Database=exampleDB;Uid=admsa; Pwd=sa;" makes it work

Upvotes: 0

cavillac
cavillac

Reputation: 1311

Side comment ... don't use .inc files. Very bad practice ... if you have an error on the page it may provide the name of your .inc that has your database connection. Since the .inc page is not an .asp, if someone types in the URL for that .inc it will just come back as plain text. WHAM ... visitor now has your connection string. Convert it to an .asp and your problems are over.

As far as the Connection String, there's too many possibilities to answer precisely so I'll just point you in the direction of http://connectionstrings.com/ Follow the right links and it should give you a template of what your connection string should be.

Upvotes: 0

Related Questions