datagrid editing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike P

    #1

    datagrid editing

    I have a datagrid with a 'Delete' column that the user can click on to
    delete a row in the datagrid. I thought that I would need to have some
    kind of error handling in case somebody goes into the database table
    that the datagrid uses and deletes a record while the user is still
    viewing the record in their datagrid, since if they then press 'Delete'
    on a record that has since been deleted from the table, a concurrency
    error should occur. But after trying this, no error is raised at all,
    on pressing 'Delete' the record is simply removed from the datagrid.
    Does anybody know why this happens? And do I therefore not need to
    provide error handling for this?


    Cheers,

    Mike



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • martin

    #2
    Re: datagrid editing

    most likely you have removed the record from the datagrid or the underlaying
    dataset and then not bound back to the database table.

    you need to delete from the database table and the rebind the datagrid.

    if you are deleting from the database using a command such as

    "Delete from mytable where record=deleteva lue"

    and this record does not exist in the db then you will not get an error. It
    is best to check the rowcount property (usually in the db) to actually
    ensure that 1 row was deleted.
    although you may think not deleting a row is an error, the database does
    not.

    hope I have understood you correctly.

    cheers

    martin

    "Mike P" <mrp@telcoelect ronics.co.uk> wrote in message
    news:O$jhabvkDH A.3700@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I have a datagrid with a 'Delete' column that the user can click on to
    > delete a row in the datagrid. I thought that I would need to have some
    > kind of error handling in case somebody goes into the database table
    > that the datagrid uses and deletes a record while the user is still
    > viewing the record in their datagrid, since if they then press 'Delete'
    > on a record that has since been deleted from the table, a concurrency
    > error should occur. But after trying this, no error is raised at all,
    > on pressing 'Delete' the record is simply removed from the datagrid.
    > Does anybody know why this happens? And do I therefore not need to
    > provide error handling for this?
    >
    >
    > Cheers,
    >
    > Mike
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    • Mike P

      #3
      Re: datagrid editing

      Martin,

      I just wondered if I should be getting an error even though I wasn't.
      I'm using direct SQL 'DELETE * FROM Table WHERE ID = ", so if this isn't
      actually meant to generate an error, it is probably OK to leave my code
      as it is...there's no need to inform the user that the record was
      deleted by somebody else, as long as it is deleted.


      Thanks,

      Mike


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Alex

        #4
        Re: datagrid editing

        Correct..


        "Mike P" <mrp@telcoelect ronics.co.uk> wrote in message
        news:uN2Iw8vkDH A.1740@TK2MSFTN GP12.phx.gbl...[color=blue]
        > Martin,
        >
        > I just wondered if I should be getting an error even though I wasn't.
        > I'm using direct SQL 'DELETE * FROM Table WHERE ID = ", so if this isn't
        > actually meant to generate an error, it is probably OK to leave my code
        > as it is...there's no need to inform the user that the record was
        > deleted by somebody else, as long as it is deleted.
        >
        >
        > Thanks,
        >
        > Mike
        >
        >
        > *** Sent via Developersdex http://www.developersdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        Working...