473,396 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

3001 Arguments are of the wrong type

I have a wrapper function for executing a SQL Server Stored Procedure
that returns no records:

Public Function modRunStoredProc(vstrSPName As String, ParamArray
vvarParams() As Variant) As Variant

On Error GoTo modRunOutputStoredProc_Err

Dim cmd As Command
Dim intIndex As Integer
Dim intParamIndex As Integer
Dim varRecsAffected As Variant

' This routine returns no outputs - varRecsAffected is simply the
number of rows affected by the SPROC
modRunStoredProc = Null

' Create command
Set cmd = New ADODB.Command
cmd.ActiveConnection = gtypUserDetails.prpOLEDBConnectString
cmd.CommandText = vstrSPName
cmd.CommandType = adCmdStoredProc

' Build parameters
intParamIndex = 0
For intIndex = 0 To UBound(vvarParams()) Step 5
cmd.Parameters.Append
cmd.CreateParameter(vvarParams(intIndex), vvarParams(intIndex + 1),
vvarParams(intIndex + 2), vvarParams(intIndex + 3))
If vvarParams(intIndex + 2) = adParamInput Then
cmd(intParamIndex).Value = vvarParams(intIndex + 4)
intParamIndex = intParamIndex + 1
End If
Next intIndex

' Execute stored procedure
cmd.Execute varRecsAffected, , adExecuteNoRecords

' Return
modRunStoredProc = varRecsAffected

modRunOutputStoredProc_Exit:
Set cmd = Nothing
Exit Function

modRunOutputStoredProc_Err:

' Get ADO Errors
Dim er As ADODB.Error, strErrNumber As String, strErrDescription
As String
strErrNumber = "Number: "
strErrDescription = "Detail: "
For Each er In cmd.ActiveConnection.Errors
strErrNumber = strErrNumber & "(" & er.Number & ") "
strErrDescription = strErrDescription & "(" & er.Description &
") "
Next
MsgBox "Server Update Problem:" & vbNewLine & strErrNumber &
vbNewLine & strErrDescription, vbOKOnly + vbExclamation,
APPLICATION_TITLE
Resume modRunOutputStoredProc_Exit

End Function

If I try to execute this:

varCDRID = modRunStoredProc("stpSetCDRFromIntranetToProcessed "
@IntranetCDRID", adInteger, adParamInput, CLng(4),
CVar(Me!fldIntranetCDRID))

I get the following errors (depending on where you look!)
"3134 Syntax error in INSERT INTO statement"

"3001 Arguments are of the wrong type, are out of acceptable range, or
are in conflict with one another."

HOWEVER, if I run this:

Dim lngSize As Long
Dim varID As Variant
Dim strParam As String

strParam = "@IntranetCDRID"
lngSize = 4
varID = Me!fldIntranetCDRID

varCDRID = modRunStoredProc("stpSetCDRFromIntranetToProcessed ",
strParam, adInteger, adParamInput, lngSize, varID)

it works fine.

Anyone got a clue why?

Thanks

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk
Nov 13 '05 #1
0 2223

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Csaba Gabor | last post by:
Inside a function, I'd like to know the call stack. By this I mean that I'd like to know the function that called this one, that one's caller and so on. So I thought to do: <script...
12
by: BartlebyScrivener | last post by:
I'm still new at this. I can't get this to work as a script. If I just manually insert the values for sys.argv and sys.argv it works fine, but I can't pass the variables from the command line. What...
4
by: mantrid | last post by:
Hello Hope you can help. I have been using the code below to move elenents around the page. This has worked fine until I put some arguments into the functions so I could use them in many places...
7
by: VK | last post by:
I was getting this effect N times but each time I was in rush to just make it work, and later I coudn't recall anymore what was the original state I was working around. This time I nailed the...
0
by: Imran | last post by:
JOB ID: BE 3001 Please refer to the Job ID in all your communication both in subject line of your email and in the body text. Hi Friends, Good Morning ,...Hope you doing good! Our client needs...
1
by: SenthilPSL | last post by:
When I call a webservice on IIS on Windows 2000 Server with .NET runtime 2.0, I get the following Error. System.Net.WebException: The operation has timed out From ASPX Pages, I call the web...
12
by: claudiu | last post by:
Hi, I'll go straight to the first question. Why does the code below compile? void f(int i = 0); int main() { (&f)();
12
by: anantraoneel | last post by:
Hi Friend My project is a Library System. In Project is Book Master form. If I've select Book Type from Type Master and Publication from Publication Master then this error has come: "Arguments...
5
by: subramanian100in | last post by:
I am copying the following text as it is from Stroustrup's TC++PL 3rd edition, page 450. It says: "Note that a constructor given two arguments of the same type can be a match for more than...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.