ByteFX and MySQL Connector inconsistencies
Posted by: mbmonk
Date: October 04, 2004 03:42AM

The exact same code, pulling from the same table yields different results depending on data provider.

MySQL version 4.0.21
ByteFX Data Provider version 0.72 (I believe)
Mysql-connector-net version1.0.0-beta


I execute the following Select statement
“SELECT LOAD_NO, DH_MILE_1, DH_MILE_2 FROM buel.load_data;”


Here is a record returned from the above select statement using the MySQL command line client:
+---------+-----------+-----------+-----------+
| LOAD_NO | DH_MILE_1 | DH_MILE_2 |
+---------+-----------+-----------+-----------+
| 81 | 56.0 | 0.0 |
+---------+-----------+-----------+-----------+

Same record returned using Byte FX (format of output is due to my code, posted below):
Record number(46) Values (81|56.0|0|)

Same record returned using MySQL Connector beta
Record number(46) Values (81|||)


As you can see the Connector beta doesn’t return a value for the last 2 fields.
The main difference is that the fields that are not returning values with the connector data provider are of the decimal data type

Here is how all the fields where defined in MySQL:
DH_MILE_1 DECIMAL(6,1) DEFAULT NULL,
DH_MILE_2 DECIMAL(6,1) DEFAULT NULL,

Load_No mentioned above is defined as follows (note: no issues with this field)
LOAD_NO CHAR(5) DEFAULT NULL,



Here are the sections of code that is executed:
Dim tbl As New DataTable
tbl = ConnectAndExecuteQueryWithTable(SelectStatement, glbUsername, glbPassword, glbHost, "buel", tbl)

Dim counter As Integer
Dim tempstring As String
counter = 1
For Each row As DataRow In tbl.Rows
tempstring = ""
For a As Integer = 0 To row.ItemArray.Length - 1
tempstring = tempstring & row.Item(a).tostring & "|"
Next
Console.WriteLine("Record number(" & counter.ToString & ") Values (" & tempstring & ")")
counter = counter + 1
Next


Function Definitions:
Public Function ConnectAndExecuteQueryWithTable(ByRef strSQL As String, ByRef Username As String, ByRef Password As String, ByRef Host As String, ByRef par_DBName As String, ByRef tbl_par As DataTable) As DataTable

'Function connects and useing Username and Password, then executes the query and returns the 'DataTable with results

Dim myCon As MySqlConnection
Dim ds As DataSet = New DataSet
myCon = New MySqlConnection
ConnectToMySQL(Username, Password, Host, par_DBName, myCon)
Dim da As MySqlDataAdapter = New MySqlDataAdapter(strSQL, myCon)
da.Fill(tbl_par)
myCon.Close()
Return tbl_par
'Return tbl
End Function

Public Function ConnectToMySQL(ByRef Username As String, ByRef Password As String, ByRef Host As String, ByRef DataBaseName As String, ByRef DBConnection As MySqlConnection) As Boolean

DBConnection.ConnectionString = "Server=" & Host & ";" & "Database= " & DataBaseName & ";user id= " & Username & ";password='" & Password & "';"


If (DBConnection.State = ConnectionState.Closed) Then
Try
DBConnection.Open()
Catch e As Exception
Return False
End Try

Return True
End If

Return True
End Function



(Important Note: This code was originally written using the ByteFx data provider)

I will post anymore information if requested. I apologize if this information is inadequate.

Options: ReplyQuote


Subject
Written By
Posted
ByteFX and MySQL Connector inconsistencies
October 04, 2004 03:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.