Amaryllis,
myCommand.CommandType = ADODB.CommandTypeEnum.adCmdText
NOTE: This is a VB.NET newsgroup! The code you gave appears to be VB6 code,
you may have better luck in one of the VB6 newsgroups or on the
iseriesnetwork.
Unfortunately, we are such a small ompany that not everyone has the
most updated versions of Client Access, so the stored procedure thing
The answer I gave is VB.NET specific, if you have VB6 you can be on an older
version of Client Access...
VB.NET, more specifically ADO.NET prefers current versions, if you are using
ADO (ADODB) you can use older versions of Client access with either VB6 or
VB.NET.
myCommand.CommandText = "Call HRZNCUSOBJ.HRCU030P('" &
myParm.Value & "', '" & myParm1.Value & "', '" &
myParm2.Value & "', '" & myParm3.Value & "')"
Why are you adding the parameters, without using parameter markers, you only
need to use one, build the entire string, or use parameters. I would
recommend using parameters.
With ADODB you can use the following which should work.
myCommand.CommandType = ADODB.CommandTypeEnum.adStoredProc
myCommand.CommandText = "HRZNCUSOBJ.HRCU030P"
Dim myParm As ADODB.Parameter
myParm = myCommand.CreateParameter("VoucherNum",
ADODB.DataTypeEnum.adVarChar,
ADODB.ParameterDirectionEnum.adParamOutput, 10, " ")
Call myCommand.Parameters.Append(myParm)
...
If you watch the CommandText property it will be converted to property Call
syntax for you, with the required number of parameter markers.
In your example the correct Call syntax, with parameter markers, is "{ call
HRZNCUSOBJ.HRCU030P(?, ?, ?, ?) }" Again if you set CommandType =
adStoredProc, ADODB will build the correct Call syntax for you.
Unfortunately ADO.NET does not...
Hope this helps
Jay
Amaryllis said:
Unfortunately, we are such a small ompany that not everyone has the
most updated versions of Client Access, so the stored procedure thing
will not work for everyone, so I was forced to get it to work another
way. Below is a copy of my code. The CL runs if I hard-code the
parameters into the call string. I just can't seem to get the output
values back from the call.
myCommand.CommandType = ADODB.CommandTypeEnum.adCmdText
myCommand.ActiveConnection = conn400
Dim myParm As ADODB.Parameter
myParm = myCommand.CreateParameter("VoucherNum",
ADODB.DataTypeEnum.adVarChar,
ADODB.ParameterDirectionEnum.adParamOutput, 10, " ")
Call myCommand.Parameters.Append(myParm)
Dim myParm1 As ADODB.Parameter
myParm1 = myCommand.CreateParameter("BatchPrf",
ADODB.DataTypeEnum.adVarChar,
ADODB.ParameterDirectionEnum.adParamInput, 3, "CDA")
Call myCommand.Parameters.Append(myParm1)
Dim myParm2 As ADODB.Parameter
myParm2 = myCommand.CreateParameter("ErrorNum",
ADODB.DataTypeEnum.adVarChar,
ADODB.ParameterDirectionEnum.adParamOutput, 2, " ")
Call myCommand.Parameters.Append(myParm2)
Dim myParm3 As ADODB.Parameter
myParm3 = myCommand.CreateParameter("ErrorFlag",
ADODB.DataTypeEnum.adVarChar,
ADODB.ParameterDirectionEnum.adParamOutput, 1, " ")
Call myCommand.Parameters.Append(myParm3)
myCommand.CommandText = "Call HRZNCUSOBJ.HRCU030P('" &
myParm.Value & "', '" & myParm1.Value & "', '" &
myParm2.Value & "', '" & myParm3.Value & "')"
myCommand.Execute()
I tried this method to get the values back, but I get an "Unknown
error"
Dim strVoucherNum As String =
strcvtr.FromBytes(myCommand.Parameters("VoucherNum").Value)
Dim strErrNum As String =
strcvtr.FromBytes(myCommand.Parameters("ErrorNum").Value)
Dim strErrFlg As String =
strcvtr.FromBytes(myCommand.Parameters("ErrorFlag").Value)