LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Method or Data Member Not Found error, after connecting to Microsoft SQL Server

Hello all!

That's the code:

Public dbsConnect As ADODB.Connection

Public Sub ConnectToDatabase()

Const sSOURCE As String = "ConnectToDatabase"

Dim lAttempt As Long
Dim sConnect As String
Dim sSQL As String
Dim rsData As Recordset

sConnect = "Provider=SQLOLEDB;Data Source=ServerName;User
ID=uid;Password=pwd;"

MsgBox "Opening Connection..."

Set dbsConnect = New ADODB.Connection
dbsConnect.ConnectionString = sConnect
dbsConnect.Open

MsgBox "i'm connected!"

-----
Up to this point everything is fine
----

Sheet1.UsedRange.Clear
sSQL = "SHOW TABLES"

Set rsData = New ADODB.Recordset
rsData.Open sSQL, sConnect, adOpenForwardOnly, adLockReadOnly,
adCmdText
--------------^^^^^^-----------
This is where I get the error - on rsData.Open
But all the samples and manuals I've found use this method, so where
lies the mistake? I'm using Excel 2003
--------------------------------

'ThisWorkbook.Sheets(1).Range("A1").CopyFromRecord set output

MsgBox "Closing Connection..."

dbsConnect.Close

MsgBox "fine"

End Sub

Private Sub CommandButton1_Click()
Call ConnectToDatabase
End Sub

 
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
Compile error: Method or data member not found Brian Day Excel Worksheet Functions 0 July 22nd 07 03:20 AM
Compile Error Method or data member not found ExcelMonkey Excel Programming 1 October 4th 05 10:41 PM
Compile Error: Method or data member not found Nick S[_4_] Excel Programming 0 November 16th 04 04:43 PM
Compile Error: Method or data member not found Nick S[_3_] Excel Programming 2 November 16th 04 02:38 PM
Compile Error: Method or data member not found Nick S[_2_] Excel Programming 1 November 16th 04 11:41 AM


All times are GMT +1. The time now is 02:45 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"