Hello all ! ! !

I'am trying to create a form that managing the access levels for an
application i create.

The form that managing the access levels contains the following :

A ListBox that desplay all the access levels
A TextBox to give or modify a name for one access level at a time
Five checkBoxes that giving the access to some fitures (i.e. The user
can print, update data, insert data, etc)

Now when i start my application i loading the ListBox with the access
levels that are stored into the Database with the following code :

conn.ConnectionString = db_connectionString

        Try
            conn.Open()

            cmRightsSel.Connection = conn
            cmRightsSel.CommandText = "SELECT * FROM
soft.access_level"
            cmRightsSel.CommandType = CommandType.Text

            daRights.SelectCommand = cmRightsSel
            cbRights = New MySqlCommandBuilder(daRights)

            dsRights.Clear()
            daRights.Fill(dsRights, "UserRights")

            ' Load the ListBox
            lsbRights.DataSource = dsRights.Tables("UserRights")
            lsbRights.ValueMember = "ACCL_ID"
            lsbRights.DisplayMember = "ACCL_NAME"

            ' Binding to dataset
            txtRightName.DataBindings.Clear()
            txtRightName.DataBindings.Add("Text",
dsRights.Tables("UserRights"), "ACCL_NAME")
            chkWrite.DataBindings.Clear()
            chkWrite.DataBindings.Add("Checked",
dsRights.Tables("UserRights"), "ACCL_INSERT")
            chkDelete.DataBindings.Clear()
            chkDelete.DataBindings.Add("Checked",
dsRights.Tables("UserRights"), "ACCL_DELETE")
            chkPrint.DataBindings.Clear()
            chkPrint.DataBindings.Add("Checked",
dsRights.Tables("UserRights"), "ACCL_PRINT")
            chkSpecialAreas.DataBindings.Clear()
            chkSpecialAreas.DataBindings.Add("Checked",
dsRights.Tables("UserRights"), "ACCL_ALLOW_ACCESS")
            chkUpdate.DataBindings.Clear()
            chkUpdate.DataBindings.Add("Checked",
dsRights.Tables("UserRights"), "ACCL_UPDATE")

        Catch ex As MySqlException
            MsgBox(ex.ErrorCode & " :: " & ex.Message)
        Finally
            If Not conn.State = ConnectionState.Closed Then
                conn.Close()
            End If
        End Try

Then when i try to load new record to Dataset i have a problem.

When i try to add a second row then I'm getting the following error
from VB

When MySqlCommandBuilder.ReturnGeneratedIdentifiers is true,
MySqlCommand.UpdatedRowSource must be set to None.

The code i use to add a new row to dataset is the following:

        daRights.Update(dsRights, "UserRights")

        Dim dsNewRow As DataRow = dsRights.Tables(0).NewRow()

        dsNewRow("ACCL_ID") = newRecordID
        dsNewRow("ACCL_NAME") = txtRightName.Text
        dsNewRow("ACCL_DESC") = "NULL"
        dsNewRow("ACCL_INSERT") = chkWrite.Checked.ToString
        dsNewRow("ACCL_UPDATE") = chkUpdate.Checked.ToString
        dsNewRow("ACCL_DELETE") = chkDelete.Checked.ToString
        dsNewRow("ACCL_PRINT") = chkPrint.Checked.ToString
        dsNewRow("ACCL_ALLOW_ACCESS") =
chkSpecialAreas.Checked.ToString

        dsRights.Tables(0).Rows.Add(dsNewRow)
        daRights.Update(dsRights, "UserRights")
        lsbRights.Enabled = True
        btnAddNew.Enabled = True
        btnCancel.Enabled = False
        btnSaveNewRecord.Enabled = False

        lsbRights.DataSource = dsRights.Tables("UserRights")
        lsbRights.ValueMember = "ACCL_ID"
        lsbRights.DisplayMember = "ACCL_NAME"


Is there anyone that know why that happens ? ? ?

Many many thanks from now to all of you ! ! !

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to