datagrid editing

Discussion in 'ASP .Net' started by Mike P, Oct 15, 2003.

  1. Mike P

    Mike P Guest

    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!
    Mike P, Oct 15, 2003
    #1
    1. Advertising

  2. Mike P

    martin Guest

    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=deletevalue"

    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" <> wrote in message
    news:O$...
    > 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, Oct 15, 2003
    #2
    1. Advertising

  3. Mike P

    Mike P Guest

    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!
    Mike P, Oct 15, 2003
    #3
  4. Mike P

    Alex Guest

    Correct..


    "Mike P" <> wrote in message
    news:...
    > 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!
    Alex, Oct 15, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QmFza2FyYW4uSy5S?=

    Disable editing a particaular column in a datagrid

    =?Utf-8?B?QmFza2FyYW4uSy5S?=, Sep 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,196
    Jonathan Allen
    Sep 25, 2004
  2. Joseph Yang
    Replies:
    1
    Views:
    521
    S. Justin Gengo
    Aug 9, 2003
  3. Mark Perona
    Replies:
    2
    Views:
    387
    Duray AKAR
    Aug 12, 2003
  4. Replies:
    0
    Views:
    585
  5. uk00121

    Editing a datagrid nested within another datagrid

    uk00121, Apr 14, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    146
    uk00121
    Apr 19, 2004
Loading...

Share This Page