Here is the routing I use:
Here's the exception: Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated. The statement has been terminated.VB Code:
Public Sub InsertData(ByRef SQL As String, ByRef parameters() As InputParameter) '1. Create a connection Dim myConnection As New SqlClient.SqlConnection(GetConnection) '2. Create the command object, passing in the SQL string or stored proc name Dim sqcmd As New SqlClient.SqlCommand(SQL, myConnection) sqcmd.Connection = myConnection sqcmd.CommandType = CommandType.StoredProcedure '3. Add parameters as needed If Not parameters Is Nothing Then For Each parm As InputParameter In parameters sqcmd.Parameters.Add(New SqlClient.SqlParameter(parm.Name, parm.Type, parm.Length)).Value = parm.Value Next End If 'Execute Stored Proc myConnection.Open() sqcmd.ExecuteNonQuery() myConnection.Close() End Sub
It seems very straight forward, but I've rechecked everthing serveral times, and none of my values are larger than the stored procedure is expecting. I'm stumped, am I just doing something very wrong here?




Reply With Quote