I am getting the error:
Parameter 4: '@IDENTITY' of type: String, the property Size has an
invalid size: 0
When trying to execute a sproc with an varchar output. Here is the
asp.net code:
with myCommand.Parameters
.Add("@ECO_DESCRIPTION", SqlDbType.VarChar).Value =
txtECODescription.text
.Add("@AUTHOR", SqlDbType.VarChar).Value =
lstAuthor.SelectedItem.Text
.Add("@ECO_COMM", SqlDbType.VarChar).Value = ECO_Comments
.Add("@CREATOR", SqlDbType.VarChar).Value = strUSer
.Add("@IDENTITY", SqlDbType.VarChar).Direction =
ParameterDirection.Output
end with
myConnection.Open()
myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
The error occurs on the @IDENTITY parameter. The datatypes are all
the same (varchar(10)) and I use the same code in other places. The
only difference is this uses a varchar and the others are using int.
When I test it with an integer:
..Add("@IDENTITY", SqlDbType.int).Direction = ParameterDirection.Output
it works, although I had to set the output in the sproc as a hardcoded
int value.