LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
zif zif is offline
external usenet poster
 
Posts: 1
Default ADO, VBA and SQL

Hi All!

I have a piece of code that was taken from a running
application. It uses ADO 2.5 to access MS Access and MS
SQL server. The code stops running when trying to connect,
and the message is # 80004005. I have added MS ADO 2.5
library as available VBA reference, and restored SQL
database from a backup. I did not set any SLQ users other
than those restored from the backup, and I am logging to
Win2000 station with different user id and password. For
this code to work, do I need to set SQLOLEDB as User Data
Source from SQL server in the ODBC Data Administrator?

The code is:

Option Explicit
Dim cDC_OK As Boolean
Dim cDC As New ADODB.Connection

Public Sub DC_Open()

On Error GoTo ErrHandler

cDC.Provider = "SQLOLEDB"
cDC.Open "Data Source= 192.168.1.113; Initial Catalog =
DB1; UID=user1;PASSWORD=mis "
cDC_OK = True
cDC.Close


Exit Sub
ErrHandler:
MsgBox Err.Description
End Sub


Thanks,
zif

 
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



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

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

About Us

"It's about Microsoft Excel"