View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
veritasca[_2_] veritasca[_2_] is offline
external usenet poster
 
Posts: 1
Default Working with ADO to connect to SQL database


Nate Oliver wrote:
*Hello,

For a nice list of OLEDB connection strings see the following:

http://tinyurl.com/80qj

Also, Dan has a nice example he

http://mrexcel.com/board2/viewtopic.php?t=53716&start=6

Regards,
Nate Oliver *


__________
Thanks, Nate.

I used Dan's nice example and got to by database connection but faile
when it tries to open the recordset, please see below:

---------
Dim adoCN As ADODB.Connection, adoRS As ADODB.Recordset
Dim strSQL As String
Set adoCN = New ADODB.Connection

adoCN.Open "Provider=sqloledb;" & _
"Data Source=DemoSQL;" & _
"Initial Catalog=template_template1backup2_db0;" & _
"User Id=User01;" & _
"Password=Snno4"

Set adoRS = New ADODB.Recordset

strSQL = "SELECT * FROM RUN"

'Open the recordset
adoRS.Open strSQL, adoCN, adOpenForwardOnly, adLockReadOnly

--------
It failed right at this last statement with a pop-up Error message
Run-time error '-2147217865(80040e37) Automation Error
How do I debug this??? Your help is appreciated. Thanks


-
veritasc
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message566438.htm