D
doofy
I'm trying to execute a stored proc from within Excel. The id and
password work for external data queries to this same database.
Here's the code:
Dim cnn As ADODB.Connection
Dim Cmd As ADODB.Command
Set cnn = New ADODB.Connection
cnn.Open
"provider=SQLoledb;SERVER=192.168.xx.yy;UID=xx;PWD=xxxxxxxx;DATABASE=YYYYYYYY"
Debug.Print cnn.State
Debug.Print cnn.ConnectionString
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = cnn
Cmd.CommandText = "execute rptRRTP_SCORECARD"
Cmd.CommandType = adCmdStoredProc
Cmd.Execute
The Debug.print lines are for debugging. Seems to bring back a properly
formatted connection string.
It blows up on that last line. This is the error I get:
Syntax error or access violation
What should I be looking at? I can log in with the id/pw I'm trying to use.
password work for external data queries to this same database.
Here's the code:
Dim cnn As ADODB.Connection
Dim Cmd As ADODB.Command
Set cnn = New ADODB.Connection
cnn.Open
"provider=SQLoledb;SERVER=192.168.xx.yy;UID=xx;PWD=xxxxxxxx;DATABASE=YYYYYYYY"
Debug.Print cnn.State
Debug.Print cnn.ConnectionString
Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = cnn
Cmd.CommandText = "execute rptRRTP_SCORECARD"
Cmd.CommandType = adCmdStoredProc
Cmd.Execute
The Debug.print lines are for debugging. Seems to bring back a properly
formatted connection string.
It blows up on that last line. This is the error I get:
Syntax error or access violation
What should I be looking at? I can log in with the id/pw I'm trying to use.