LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.querydao,microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default connect to sql

Excel 2000, 2003

I've built an app that connects to sql and does various things. On some
machines it works just fine, on other machines it throws an error. The
error occurs when I attempt to connect to sql. The error is:
Run-time error '-2147467259 (80004005)';
Automation error
Unspecified error


My connection code is below.
Sub Connect()

Set rs = New ADODB.Recordset
Set cn = New ADODB.Connection
sADOConnect = "DSN=MyDSN;UID=MyUID;PWD=MyPwd"

With cn
.CursorLocation = adUseClient
.ConnectionString = sADOConnect
.ConnectionTimeout = 180
.CommandTimeout = 180
.Properties("Prompt") = adPromptCompleteRequired
.Open
End With

End Sub

Can anyone tell me what is causing this error, and how I can get around it?

Thanks, Andre


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect PC to UNIX via TCP/IP [email protected] Links and Linking in Excel 0 January 20th 07 09:34 PM
Excel cannot connect to web Ltat42a Excel Discussion (Misc queries) 0 May 29th 06 05:18 PM
connect to MS SQL mk Excel Programming 1 April 3rd 05 08:35 PM
connect to an oracle db b geber Excel Programming 1 February 4th 05 07:27 PM
SQL Connect Soniya[_3_] Excel Programming 2 January 31st 05 07:39 AM


All times are GMT +1. The time now is 01:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"