ADO and sybase stored proc parameters data type problem
when i am trying to call the store procedure i am facing problem. if the input parameter is adinteger it is working fine . if input parameter is adVarchar, it shows the run time error " Method 'Excute of' object _Command failed ".plz any one help me. THanks in advance.
my code is...
Private Sub Command1_Click()
Dim cmd As New ADODB.Command
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim qry As String
Dim input_param As string
Dim output_param As Integer
Dim inp1 As Integer
input_param = "PARTCPNTCD"
inp1 = 1
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command
rs.CursorLocation = adUseClient
gDSN = "HPCUST"
gDBId = "sa"
gPWD = ""
cn.ConnectionString = "DSN=" & gDSN & ";uid=" & gDBId & ";pwd=" & gPWD & ";"
cn.Open
MsgBox "connected"
cn.CursorLocation = adUseClient
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc 'when using SP with command object
cmd.CommandText = "tempdb..testProc"
' The below line gives the error. if the datatype is adInteger and input parameter is integer then it is working.if tit is varchar it is not working.
cmd.Parameters.Append cmd.CreateParameter("@i_ld", adVarChar, adParamInput, 20, input_param)
cmd.Parameters.Append cmd.CreateParameter("@o_ErrDesc", adVarChar, adParamOutput, 200)
Set rs = cmd.Execute
MsgBox "Resultset prepared"
MsgBox rs(0)
rs.Close
cn.Close
End Sub
Thanks in advance.
-ttkprakash

