i need more information about concurrency

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
jimmy

i need more information about concurrency

Post by jimmy » Sun 27 Feb 2005 12:17

i have a MySQLDirect .NET Data Provider 2.00
i need more information about this

Private Sub ROWUPDATED(ByVal sender As Object, ByVal e As CoreLab.MySql.MySqlRowUpdatedEventArgs)
If e.Status = UpdateStatus.ErrorsOccurred Then

msgbox ("error")

end If

End Sub

this event only it works with primary keys.

i need that i work with all the columns of the datarow

thank you

Serious

Post by Serious » Mon 28 Feb 2005 13:40

Try this code
(select command text: "select * from dept" (see "tables.sql" in "samples" folder))

Code: Select all

  Private Sub table_RowUpdated(ByVal sender As Object, ByVal e As CoreLab.MySql.MySqlRowUpdatedEventArgs) Handles table.RowUpdated
    MessageBox.Show("updated")
  End Sub

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    table.Fill()
  End Sub

  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    table.Rows.Item(1).Item("dname") = 1
    table.Update()
  End Sub

jimmy

I continue with doubts

Post by jimmy » Mon 28 Feb 2005 22:59

Thank you. But I want to know when another user to modified the same record that I. This event always me works when it is a principal key but I want to detect any.

Serious

Post by Serious » Tue 01 Mar 2005 14:49

You need to create Update command manually:

Code: Select all

UPDATE dept SET DEPTNO = :p1, DNAME = :p2, LOC = :p3 WHERE DEPTNO = :pNo, dname = :pName, loc=:pLoc
You can do it as follows:
1. generate commands with MySqlDataTable editor (command generator tab).
2. Add all table columns in where list.
3. Modify parameters for this columns (pNo,pName,pLoc in examle): set source version to "current", data type and data column to appropriate values.
4. In your application use similar syntax:

Code: Select all

try
{
  dataTable.Rows[2]["dname"] = "4";
  dataTable.Update();
  if (dataTable.Rows[2].HasErrors == true)
    MessageBox.Show("error");
}
catch
{
}

Post Reply