Bug #14631 "#42000Query was empty"
Submitted: 4 Nov 2005 9:41 Modified: 20 Nov 2005 4:59
Reporter: Alex Chiang Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.6 OS:Microsoft Windows (WinXP)
Assigned to: Reggie Burnett CPU Architecture:Any

[4 Nov 2005 9:41] Alex Chiang
Description:
When i use MySqlCommandBuilder to execute Update Command
if the CommandText String ends with ";" 
I will got a "#42000Query was empty" MySqlException!

How to repeat:
VB.NET Code here:
First! require imports MySql.Data.MySqlClient

Try
   Dim connStr As String = "SERVER=localhost;UID=root;DATABASE=test;PASSWORD=123;PORT=3306;CHARSET=utf8;"
   Dim conn As New MySqlConnection(connStr)
   conn.Open()

   Dim sqlCreate As String = "CREATE TABLE IF NOT EXISTS tt (id INTEGER AUTO_INCREMENT PRIMARY KEY, data VARCHAR(100));"
   Dim cmd As MySqlCommand = New MySqlCommand(sqlCreate, conn)
   cmd.ExecuteNonQuery()

   Dim sql As String = "SELECT * FROM tt;"  '*HERE* if remove ; it'll work fine!
   Dim da As New MySqlDataAdapter(sql, conn)
   Dim builder As New MySqlCommandBuilder(da)
   Dim dt As New DataTable
   da.Fill(dt)

   Dim dr As DataRow = dt.NewRow
   dr(1) = "Test"
   dt.Rows.Add(dr)

   da.Update(dt)

   conn.Close()
Catch ex As Exception
   MsgBox(ex.Message)
End Try
[4 Nov 2005 9:51] Alex Chiang
Try this vb.net project to repeat the bug!

Attachment: MySqlBug_Query_was_empty.zip (application/zip, text), 22.07 KiB.

[4 Nov 2005 9:54] Alex Chiang
Server is  MySQL 5.0.15-nt via TCP/IP on WinXP SP2
[6 Nov 2005 10:56] Vasily Kishkin
Thanks for the bug report and test case. I was able to reproduce the bug on mysql 4.1.16 and 5.0.15.
[16 Nov 2005 16:38] Reggie Burnett
Fixed in 1.0.7
[20 Nov 2005 4:59] Paul Dubois
Noted in 1.0.7 changelog.