title: VS2010 MySqlException was unhandled
body: <p>I am new to VB programming and have come across an problem:(  after a couple of days trying to resolve this need some help!</p>
  
  <p>I am trying to pass some information from a VB form to my MySQL database. i have named all the textbox's the same as the field in the database and checked all my database fields and textbox names which are all correct.</p>
  
  <p>When i try to enter information into a form I sometimes get an error at the .executeNonQuery section of the code. </p>
  
  <p>To test, I outputted the SQLStatement string to a textbox ( which pulled through all the fields from the textboxes correctly) then manually inputted the completed SQL query into the database and it worked. But when I try to do this in one go it seems to fail if there is too much text ( if i enter 'a' into each field it works). Are they limits to the size of the SQL query that can be passed from VB?? all the MySql database fields are set to text with no size limits.</p>
  
  <p>Thanks in advance!!!</p>
  
  <pre><code>    Public Sub SaveQuote(ByRef SQLStatement As String)
      Dim cmd As MySqlCommand = New MySqlCommand
  
      With cmd
          .CommandText = SQLStatement
          .CommandType = CommandType.Text
          .Connection = SQLConnection
          .ExecuteNonQuery()
      End With
      SQLConnection.Close()
      MsgBox("successfully Added!")
      SQLConnection.Dispose()
  End Sub
  
  Private Sub CmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSave.Click
  
      Dim SQLstatement As String = "INSERT INTO laptopstock(forename,surname,emailaddress,contactnumber,quotedate,manufacturer,model,os,battery,drive,defects) VALUES('" &amp; forename.Text &amp; "','" &amp; surname.Text &amp; "','" &amp; emailaddress.Text &amp; "','" &amp; contactnumber.Text &amp; "', CURDATE(),'" &amp; manufacturer.Text &amp; "','" &amp; modelnumber.Text &amp; "','" &amp; os.Text &amp; "','" &amp; batterycondition.Text &amp; "','" &amp; drivetype.Text &amp; "','" &amp; defects.Text &amp; "')"
      SaveQuote(SQLstatement)
  End Sub
  </code></pre>
  
  <p>'Test SQL query</p>
  
  <pre><code>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
  
      Dim testSQLstatement As String = "INSERT INTO laptopstock(forename,surname,emailaddress,contactnumber,quotedate,manufacturer,model,os,battery,drive,defects) VALUES('" &amp; forename.Text &amp; "','" &amp; surname.Text &amp; "','" &amp; emailaddress.Text &amp; "','" &amp; contactnumber.Text &amp; "', CURDATE(),'" &amp; manufacturer.Text &amp; "','" &amp; modelnumber.Text &amp; "','" &amp; os.Text &amp; "','" &amp; batterycondition.Text &amp; "','" &amp; drivetype.Text &amp; "','" &amp; defects.Text &amp; "')"
  
  
      testbox.Text = testSQLstatement
  
  End Sub
  </code></pre>
  
  <p>here is the output from testSQLstatement = testbox.text</p>
  
  <pre><code>    INSERT INTO laptopstock(forename,surname,emailaddress,contactnumber,quotedate,manufacturer,model,os,battery,drive,defects) VALUES('Joe','Bloggs','J.bloggs@jbloggs.com','07777777777', CURDATE(),'Sony','Vaio','Windows 7 Pro','Poor','DVD-Rom','Faulty Screen')
  </code></pre>
  
  <p>from what i can see it is correctly formatted and when i enter this directly into a query on the MySql server a record is created</p>