Unhandled SqlException

This code has worked 100 times and suddenly I received the following message....I have no idea where it came from....

SqlException was unhandled
String or binary data would be truncated.
The statement has been terminated.

The error is happening at this code:
DA_Slip_Header.Update(DS_Slip_Header, "Slip_Info")

AND this code is in a Try/Catch - but I took it out to see exactly where the error is occuring...

There is a button click that triggers this sub...

Private Sub Save_Slip_Header_Info()

        Dim command_builder As SqlCommandBuilder
        Dim DA_Slip_Header As SqlDataAdapter
        DA_Slip_Header = New SqlDataAdapter("Select * from Slip_Info", My.Settings.IEC_DB_Connection)

        command_builder = New _

        Dim DS_Slip_Header As DataSet = New DataSet

        Dim dtaSlip_Info As New DataTable("Slip_Info")

        DA_Slip_Header.TableMappings.Add("Table", "Slip_Info")

        Dim Row_Slip_Header As DataRow = dtaSlip_Info.NewRow
        Row_Slip_Header("Slip_Number") = Me.txt_Slip_Number.Text
        Row_Slip_Header("Job_Number") = Me.txt_Job_Number.Text
        Row_Slip_Header("SWO_ID") = Me.txt_SWO_ID.Text
        Row_Slip_Header("Engineer_Last_Name") = Me.txt_Engineer.Text
        Row_Slip_Header("Contractor_Name") = Me.txt_contractor.Text
        Row_Slip_Header("Description") = Me.txt_Description.Text
        Row_Slip_Header("Slip_Date") = Me.DatePick_Slip_Date.Value.ToString
        Row_Slip_Header("Date_Added") = Date.Today.ToString
        Row_Slip_Header("Date_Changed") = Date.Today.ToString
        Row_Slip_Header("CreatedBy") = "tgeorge"
        Row_Slip_Header("Location") = Me.txt_Location.Text


        DA_Slip_Header.Update(DS_Slip_Header, "Slip_Info")

        'Clear all the textboxes

    End Sub

Open in new window

Who is Participating?
Pratima PharandeCommented:
This error message appears when you try to insert a string with more characters than the column can maximal accommodate.

The statement cannot be executed this way. You must either shorten the string to be isnerted to widen the column.
Paul JacksonSoftware EngineerCommented:
The error suggests that some of the data being added would be truncated when updated in the database because the size of the database column is too small.
tobin46Author Commented:
Ahhh...I think its the line:
Row_Slip_Header("Slip_Date") = Me.DatePick_Slip_Date.Value.ToString

I changed the length in the DB and I believe it is trying to add as date time: 5/4/2011 12:13:00AM...

Let me address this somehow...
tobin46Author Commented:
Thanks, that was it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.