J
Jim Heavey
I am trying to figure out how to call a stored procedure. I have entered the
following lines of code ....
Dim cmd As New Command
cmd.CommandType = adCmdStoredProc
Dim parm1 As Parameter
With parm1
.DataType = xlParamTypeInteger
.Name = "i_User_ID"
.Value = 1
End With
Dim parm2 As Parameter
With parm2
.Name = "i_Time_ID"
.DataType = xlParamTypeInteger
.Value = 136
End With
cmd.Parameters.Append (parm1)
cmd.Parameters.Append (parm2)
cnn.ConnectionString = "Provider=MSDAORA.1;Password=YYYYYY;User
ID=XXXXX;Data Source=ZZZZZZZ;Persist Security Info=True"
cmd.ActiveConnection = cnn
cmd.Execute
The code fails when I attempt to place something into my Parameter with the
following error "Object Variable or with block not set". Sounds like it
wants me to instatiate the object, but I can not use the "new" with
"Parameter" object.
So what am I doing wrong? How do I associate the Command Object with the
Connection Object....I was guessing "cmd.ActiveConnection".
Thanks in advance for your assistance!!!
following lines of code ....
Dim cmd As New Command
cmd.CommandType = adCmdStoredProc
Dim parm1 As Parameter
With parm1
.DataType = xlParamTypeInteger
.Name = "i_User_ID"
.Value = 1
End With
Dim parm2 As Parameter
With parm2
.Name = "i_Time_ID"
.DataType = xlParamTypeInteger
.Value = 136
End With
cmd.Parameters.Append (parm1)
cmd.Parameters.Append (parm2)
cnn.ConnectionString = "Provider=MSDAORA.1;Password=YYYYYY;User
ID=XXXXX;Data Source=ZZZZZZZ;Persist Security Info=True"
cmd.ActiveConnection = cnn
cmd.Execute
The code fails when I attempt to place something into my Parameter with the
following error "Object Variable or with block not set". Sounds like it
wants me to instatiate the object, but I can not use the "new" with
"Parameter" object.
So what am I doing wrong? How do I associate the Command Object with the
Connection Object....I was guessing "cmd.ActiveConnection".
Thanks in advance for your assistance!!!