Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: "Application uses a value of the wrong type for the current operation."

202| Tue, 05 Feb 2008 17:22:00 GMT| bmkavitz| Comments (0)
When setting the parameter values of an ADO command object to execute a parameter query, I get this message if the data being sent to the parameter is larger than the destination field. Is there a workaround for this? RDO querydef objects automatically truncated data being passed into parameters. Here is an example of how I am setting the parameter values:
<vbcode>
Public Sub ExecuteSQL(ByVal SQL As String, ParamArray args() As Variant)
Dim i As Integer
Dim cmd As New ADODB.Command

If SQL <> vbNullString Then
cmd.CommandType = adCmdText
cmd.CommandText = SQL
cmd.ActiveConnection = cn
End If

For i = 0 To UBound(args)
cmd(i) = args(i)
Next

cmd.Execute

Set cmd = Nothing

End Sub
</vbcode>

Keywords & Tags: application, uses, value, wrong, type, current, operation, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/143/
 
«« Prev - Next »» 0 helpful answers below.

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories