title: Error while inserting data in the sql server database using vb.net
body: <p>I'm using the following code to insert the data in a table and i am getting the error at cmd.executenonquery()....The exception is labelled as SQL exception and the underlying message says "String or binary data would be truncated. The statement has been terminated."</p>
  
  <pre><code>        Dim str As String  ' defines str as a string variable
  
          'takes insertion query as a string in str variable
          str = "Insert into Instructors Values(@inst_id, @inst_name, @contact, @game, 'N/A', 'N/A', 'Available')"
  
          'defines a new command which takes query string and connection string as parameters
          Dim cmd As New SqlCommand(str, con)
  
          ' defines Instructor ID parameter and takes its value from the form 
          Dim prmInstID As New SqlParameter("@inst_id", SqlDbType.Int)
          prmInstID.Value = TxtInstID.Text
  
          ' defines Instructor Name parameter and takes its value from the form 
          Dim prmInstName As New SqlParameter("@inst_name", SqlDbType.Char)
          prmInstName.Value = TxtInstName.Text
  
          ' defines Contact parameter and takes its value from the form 
          Dim prmContact As New SqlParameter("@contact", SqlDbType.VarChar)
          prmContact.Value = MskdTxtCntctno.Text
  
  
          ' defines Specialty Game parameter and takes its value from the form 
          Dim prmGame As New SqlParameter("@game", SqlDbType.VarChar)
          prmGame.Value = Me.ComboBox1.SelectedItem
  
          cmd.Parameters.Add(prmInstID)
          cmd.Parameters.Add(prmInstName)
          cmd.Parameters.Add(prmContact)
          cmd.Parameters.Add(prmGame)
  
  
          cmd.ExecuteNonQuery()
  
          con.Close()
  </code></pre>