Bug #4671 concurrency exception when updating a table with a case sensitive field in it
Submitted: 21 Jul 2004 14:20 Modified: 26 Jul 2004 22:37
Reporter: Dave van Vugt Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:0.76 (ByteFX) OS:Windows (WinXP pro)
Assigned to: Reggie Burnett CPU Architecture:Any

[21 Jul 2004 14:20] Dave van Vugt
Description:
> I copied the relevant code:
> ------------------------------
> dadPassingen = New MySqlDataAdapter("SELECT * FROM tolerantie order by 
> passingnorm,min_bereik", conAdcosAlgemeen) Dim cbuBuilder As New 
> MySqlCommandBuilder(dadPassingen)
> 
> Try
>   dadPassingen.Fill(dseSet, "tolerantie") Catch ex As Exception
>   MessageBox.Show(ex.Message, "Foutmelding")
>   Exit Sub
> End Try
> 
> 'zorg dat tabel tolerantie case-sensitive is 
> dseSet.Tables("tolerantie").CaseSensitive = True
> 
> 'primary key in dataset vastleggen
> Dim myColArray(3) As DataColumn
> myColArray(1) = dseSet.Tables("tolerantie").Columns("passingnorm")
> myColArray(0) = dseSet.Tables("tolerantie").Columns("min_bereik")
> myColArray(2) = dseSet.Tables("tolerantie").Columns("max_bereik")
> 
> dseSet.Tables("tolerantie").PrimaryKey = myColArray
> 
> ----- click edit-button ------
> strBewerktePassingNorm = Me.txtPassingNorm.Text.Trim 
> dblBewerkteMinBereik = Me.nudMinBereik.Value dblBewerkteMaxBereik = 
> Me.nudMaxBereik.Value
> 
> ----- save changes ------
> Dim droCurrentRow As DataRow
> 
> Dim strKey(2) As Object
> strKey(1) = strBewerktePassingNorm
> strKey(0) = dblBewerkteMinBereik
> strKey(2) = dblBewerkteMaxBereik
> 
> droCurrentRow = Me.dseSet.Tables("tolerantie").Rows.Find(strKey)
> Try
>   droCurrentRow.BeginEdit()
>   droCurrentRow.Item("passingnorm") = Me.txtPassingNorm.Text.Trim
>   droCurrentRow.Item("min_bereik") = Me.nudMinBereik.Value
>   droCurrentRow.Item("max_bereik") = Me.nudMaxBereik.Value
>   droCurrentRow.Item("min_tolerantie") = Me.nudMinTol.Value
>   droCurrentRow.Item("max_tolerantie") = Me.nudMaxTol.Value
>   droCurrentRow.EndEdit()
> End Try
> 
> Dim dseModified As DataTable =
> dseSet.Tables("tolerantie").GetChanges(DataRowState.Modified)
> 
> Try
>   If Not IsNothing(dseModified) Then
>     dadPassingen.Update(dseModified)   'HERE IT GOES WRONG!
>     dseSet.Tables(strTabelNaamDataSet).AcceptChanges()
>   End If
> 
>   Catch dbcx As DBConcurrencyException
> 	...THIS EXCEPTION OCCURS!
> End Try
> 
> ------------------------------
> De table looks like this:
> CREATE TABLE `tolerantie` (
>   `passingnorm` varchar(4) binary NOT NULL default '',
>   `min_bereik` float NOT NULL default '0',
>   `max_bereik` float NOT NULL default '0',
>   `min_tolerantie` float NOT NULL default '0',
>   `max_tolerantie` float NOT NULL default '0',
>   PRIMARY KEY  (`min_bereik`,`passingnorm`,`max_bereik`)
> ) TYPE=MyISAM;
> ------------------------------
> 
> I do the same for many other tables, which give no problems. I can't 
> help thinking the 'binary' (case-sensitive) field has something to do 
> with it, but I can't figure out what.

How to repeat:
use code above

Suggested fix:
?
[26 Jul 2004 17:30] Dave van Vugt
Sorry, not a bug!
The problem was initiated due to float/double instead of decimal problems.
The usual rounding misery.

Changing the db-fields from float to decimal solved the problem.
[26 Jul 2004 22:37] Reggie Burnett
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem is not the result of a bug.
For a list of more appropriate places to ask for help using MySQL
products, please visit http://www.mysql.com/support/

Thank you for your interest in MySQL.

Additional info:

No problem!  Thanks for following up.