Page 1 of 1

Net packets out of order problem

Posted: Thu 16 Jun 2005 21:50
by Port80 Software
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

Posted: Fri 17 Jun 2005 15:03
by Oleg
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.

Posted: Tue 21 Jun 2005 15:22
by Port80 Software
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