Wednesday 15 January 2014

Having trouble connecting to SQL Server database from VBA using ADO connection -



Having trouble connecting to SQL Server database from VBA using ADO connection -

i want connect sql server database without using dsn. i'm receiving error when trying connect said database. error

run-time error '-2147467259 (80004005)': [microsoft][odbc driver manager] info source name not found , no default driver specified

my connection string looks this:

"odbc;driver=sql server;server=lokdb; uid=secret;pwd=secret;app=microsoft open database connectivity;wsid=" & environ$("computername") & ";network=dbmssocn;trusted_connection=yes;database=edms-lok"`

i able connect default database on server credentials specified if remove database=edms-lok parameter connection string, don't seem able "find" edms-lok database. e.g. if seek using

select * edms-lok.dbo.eng_dwg

i error message

run-time error '-2147217900 (80040e14)': [microsoft][odbc sql server driver][sql server]incorrect syntax near '-'

(eng_dwg valid table)

when connect without specifying database, .defaultdatabase property of ado connection object returns "020" don't see available database on server??

when connected, if utilize select name sys.databases i'm able list of databases available. are:

010 100 500 edms-lok master msdb msllockdb pubs tempdb

i got working using dsn, don't want utilize dsn.

not sure wrong here??

i problem mix authentication models. provide user + password have configured trusted connection = yes. i'm not sure how ado works in case assume doesn't utilize configured user , connects windows account. delete trusted connection parameter in connection string , seek again.

sql-server database vba database-connection connection-string

No comments:

Post a Comment