Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arguments are of the wrong type error

Status
Not open for further replies.

Kflasph

Programmer
Apr 8, 2002
65
US
Good morning,
I have a data enviroment set up in my VB6 project with a stored procedure that I am calling within a form in the same project. The stored procedure that I am calling passes four values and returns two.
Example:
Create procedure upDateTable (@intValue1 int, @sValue2 char(6) output, @intValue3 int Output, @sValue char(10))

I can run the stored procedure from the Query Analyzer with no problems so I know that I it not a SQL/Stored Procedure problem.

The values that I pass are in order - 1,'345674',5,'SAMPLE'

After testing the call from my VB project to the store procedure ( by modifying the stored proc to not return values and then by only returning a value one at a time ) , I was able to determine that it was the @sValue2 char(6) output that was causing the error. For some reason, my project does not except the return value of the stored procedure. Again, I know it is not the stored procedure.

The complete error I get is : 'Arguments are of the wrong type, are out of acceptable range , or are in conflict with one another.

I have the variable that I am originally passing to the stored procedure declared as a string in my project.

I have stepped through it with the Debugger and the value that I am passing '345674' returns as the same value or another string. I have even added print statements when I run it to make sure that my debugger was correct. I am not returning a integer or a Null when I get the error in Visual Basic.


Is there something that I am not setting in the properties of the stored procedure in the Data Environment? Right now, I have just the defaults as I am not returning a recordset but only the output values.

Thanks for any help,
KFlasph
 
I never use Data Environment and hardly ever use SQL char types. However, two possible things I can think of trying:

1. CStr(MyVariable) to convert the result to string
OR
2. Declare your variable as a fixed width string
Code:
Dim Result As String * 6
 
Believe it or not, it was a rtrim I had on the string when I was calling the stored proc using the data environment.
Since it was coming back into the variable, I guess you can't try to do a trim.
Live and Learn !

Thanks for the help anyway.

KFlasph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top