Net packets out of order problem

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Port80 Software
Posts: 7
Joined: Tue 19 Apr 2005 16:14
Location: Belgium

Net packets out of order problem

Post by Port80 Software » Thu 16 Jun 2005 21:50

Hi,

When I execute this command :

Code: Select all

    Public Sub GetPays(ByVal cbo As Janus.Windows.EditControls.UIComboBox, Optional ByVal cbo2 As Janus.Windows.EditControls.UIComboBox = Nothing, Optional ByVal cbo3 As Janus.Windows.EditControls.UIComboBox = Nothing)
        Dim mySelectQuery As String = "SELECT `ID_Pays`,`Pays`, `Flag` FROM ztbl_country"
        Dim myCommand As New CoreLab.MySql.MySqlCommand(mySelectQuery, MySQLConnexion)
        cbo.Items.Clear()
        If Not cbo2 Is Nothing Then cbo2.Items.Clear()
        If Not cbo3 Is Nothing Then cbo3.Items.Clear()
        Try
            Dim myReader As CoreLab.MySql.MySqlDataReader = myCommand.ExecuteReader()
            ' Always call Read before accessing data.
            While myReader.Read()
                cbo.Items.Add(myReader.GetString(myReader.GetOrdinal("Pays")), myReader.GetString(myReader.GetOrdinal("ID_Pays")))

                If Not cbo2 Is Nothing Then
                    cbo2.Items.Add(myReader.GetString(myReader.GetOrdinal("Pays")), myReader.GetString(myReader.GetOrdinal("ID_Pays")))
                End If

                If Not cbo3 Is Nothing Then
                    cbo3.Items.Add(myReader.GetString(myReader.GetOrdinal("Pays")), myReader.GetString(myReader.GetOrdinal("ID_Pays")))
                End If

                Dim myBlob As CoreLab.MySql.MySqlBlob = myReader.GetMySqlBlob(myReader.GetOrdinal("Flag"))

                If Not myBlob.IsEmpty Then
                    cbo.Items(myReader.GetString(myReader.GetOrdinal("Pays"))).Image = New Bitmap(myBlob)
                    If Not cbo2 Is Nothing Then
                        cbo2.Items(myReader.GetString(myReader.GetOrdinal("Pays"))).Image = New Bitmap(myBlob)
                    End If
                    If Not cbo3 Is Nothing Then
                        cbo3.Items(myReader.GetString(myReader.GetOrdinal("Pays"))).Image = New Bitmap(myBlob)
                    End If
                End If

            End While
            ' always call Close when done reading.
            myReader.Close()
            cbo.SelectedItem = cbo.Items("Belgique")
            If Not cbo2 Is Nothing Then
                cbo2.SelectedItem = cbo.Items("Belgique")
            End If
            If Not cbo3 Is Nothing Then
                cbo3.SelectedItem = cbo.Items("Belgique")
            End If

        Finally
            myCommand.Dispose()
            mySelectQuery = Nothing
        End Try
The first query result an error as :
Net packet out of order : received [0], expected[59]

If I ignore this error an try to recall this fuction this error not appear !

Note:
the number in expected[xxx] is not same each time
Any idea to solve my problem ?

Thanks,

Didier Lombet
Hostonet

P.S. : I use the last release pro of MySQLDirect

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Post by Oleg » Fri 17 Jun 2005 15:03

Probably you use MySQLConnexion variable from several threads.
Try to create a new MySQLConnexion each time.
What is your version of MySQL server?
Do you have this error each time when you execute the command?
Add to your Finally section myReader.Close() line.

Port80 Software
Posts: 7
Joined: Tue 19 Apr 2005 16:14
Location: Belgium

Post by Port80 Software » Tue 21 Jun 2005 15:22

I Have try this solution :
Oleg wrote:Try to create a new MySQLConnexion each time.
now, It work perfectly :D
Oleg wrote:What is your version of MySQL server?
Version 4.3.11
Oleg wrote:Do you have this error each time when you execute the command?
No, not, it is really random

Post Reply