SQL Exception Unhandled Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sari saji
    New Member
    • Feb 2012
    • 7

    SQL Exception Unhandled Error

    Here iam trying to insert some values to SQLServer 2005 Database.The following error displaying.I changed the corresponding column size,still the error persists.how can i sove this error-:

    'String or binary data would be truncated.
    The statement has been terminated'
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    That error message says you're trying to insert a value that's larger than the specified length in SQL. So you got 2 choices; increase the columns max length or shorten what you're trying to insert.

    Comment

    • sari saji
      New Member
      • Feb 2012
      • 7

      #3
      I changed the corresponding column size,still the error persists

      Comment

      • PsychoCoder
        Recognized Expert Contributor
        • Jul 2010
        • 465

        #4
        OK show us what you're doing to generate this error (show the code), also show the code of your table and tell us which variable generates this error message.

        Comment

        • sari saji
          New Member
          • Feb 2012
          • 7

          #5
          This is the insert function in vb.net

          Me.Personal_det ailsdbTableAdap ter.Insert(Me.F irstnameTextBox .Text, Me.LastnameText Box.Text, _
          Me.PassportnoTe xtBox.Text, Me.Placeofbirth TextBox.Text, _
          Me.SexTextBox.T ext, Me.DobDateTimeP icker.Value)



          This is the SQL Database Table Design

          firstname nvarchar(50) Checked
          lastname varchar(20) Checked
          passportno nvarchar(50) Unchecked(Prima ry Key)
          placeofbirth varchar(25) Checked
          sex varchar(20) Checked
          dob datetime Checked

          Comment

          Working...