Hi Guys,
i need a little help here,
I am trying to execute my stored Procedure from SQL Server and use it as data source.
My code is:
Code:
Sub ConToSQL()
Dim rs As Object
Dim con As Object
Set rs = CreateObject("ADODB.Recordset")
Set con = CreateObject("ADODB.connection")
With con
.ConnectionString = "Provider=SQLOLEDB;Data Source=NT-WRO1-PLAT01\SQLEX2014;Initial Catalog=Sody;User ID=MyID;Password=MyPass"
.Open
If .State = 0 Then
MsgBox "Nie mogę otworzyć polączenia", vbInformation, "Błąd:"
End If
End With
With rs
.ActiveConnection = con
.CursorLocation = 3
.CursorType = 3
.LockType = 1
.Open "Select * from tbl_Slownik"
End With
End Sub
my SP name is SP_SQL.
Instead of using:
Code:
.Open "Select * from tbl_Slownik"
i want to use stored procedure here and pass the result into Access recordset.
How can i do it?
Jacek