Bug #28252 make select on table but some values are bytes[] instead inte
Submitted: 4 May 2007 17:24 Modified: 21 May 2007 14:54
Reporter: Sebastien Bonnet Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.1.0 and 5.0.6 OS:Windows (xp sp2, mysql 5.0.37 community)
Assigned to: CPU Architecture:Any
Tags: system.bytes integer select .NET 5.1.0 5.0.6

[4 May 2007 17:24] Sebastien Bonnet
Description:
hello,
MySQL 5.0.37 community
Windows XP SP2 full update
Visual Studio 2005 sp1
connector/NET 5.1 but same problem with 5.0.6

i create an object that manage connection with mysql server
in this object, i create datatable property and this property serve me to collect result from select....

i use a select with connector on table
i save result from datatable property into a data grid and who forms...
when i want to save or read, error message
Source: MySQL.Data
Number: 1366
Code SQLSTATE: incorrect integer value: system.bytes[] for column....

i use integer value, not bytes array
when i debug this select and copy data from datatable property to datagrid,
i see that some values, not all, are bytes[] instead integer

i dont understand because i did some test with phpmyadmin and request:
perfect, all values (text, integer...) and no bytes array
and with another client mysql: SQLyog entreprise: idem, perfect

so, i arrive to conclusion that your connector has a problem...

How to repeat:
VB .NET
Public MySQLConnection As Nexus.network.MySQL
---> property to MySQLConnection: 
Private _datatable As System.Data.DataTable = New System.Data.DataTable

**request**
MySQLConnection.MySQL_select(request, "?param1", param1)

**the result is into datatable property**
formulaire.DataTable1 = MySQLConnection.datatable

and to this moment, i have the bug
[4 May 2007 17:53] Sebastien Bonnet
i send mthode select to mysql data

Public Sub MySQL_select(ByVal myQuery As String, ByVal ParamArray myParameters() As String)

 
            _datatable = New System.Data.DataTable

            _MySQL_command = New Global.MySql.Data.MySqlClient.MySqlCommand(myQuery, _mySQL_Connection)

            _MySQL_adapter.SelectCommand = _MySQL_command

            If myParameters.Length > 0 Then
                For i As Integer = 0 To myParameters.Length - 1 Step 2
                    If myParameters(i + 1).ToString = "Null" Then
                        _MySQL_adapter.SelectCommand.Parameters.AddWithValue(myParameters(i), DBNull.Value)
                    Else
                        _MySQL_adapter.SelectCommand.Parameters.AddWithValue(myParameters(i), myParameters(i + 1))
                    End If
                Next
            End If
            Try

                _MySQL_adapter.Fill(_datatable)
            Catch e As Global.MySql.Data.MySqlClient.MySqlException

                Nexus.erreurs.message_erreur_mysql(e.Source, e.Number, e.Message, myQuery, myParameters)

                _datatable = Nothing

            End Try

  

        End Sub
[4 May 2007 18:06] Sebastien Bonnet
i think i have the solution !!!!!

   Public select_phaseB7_drugs As String = "SELECT IFNULL(drug_dunit,'') as drug_dunit," & _
"IFNULL(drug_numinterunit,'') as drug_numinterunit," & _
"IFNULL(drug_reactionoccur,'') as drug_reactionoccur " & _
"FROM drugs WHERE drug_fileid=?drug_fileid;"

this is my initial request
i inspect table and i see that these fields are int(11), not varchar

i modify :
   Public select_phaseB7_drugs2 As String = "SELECT IFNULL(drug_dunit,0) as drug_dunit," & _
"IFNULL(drug_numinterunit,0) as drug_numinterunit," & _
"IFNULL(drug_reactionoccur,0) as drug_reactionoccur " & _
"FROM drugs WHERE drug_fileid=?drug_fileid;"

AND WORKING !!!!!!!

but i don t understand why with phpmyadmin and SQLyog, the first request work too
[21 May 2007 14:54] Reggie Burnett
This is a duplicate of other bugs and has already been fixed in 5.0.7 and 5.1.1