Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. datagrid row problem

datagrid row problem

Scheduled Pinned Locked Moved C#
helpquestiondatabaseregex
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mdolby
    wrote on last edited by
    #1

    Hi, I have a datagrid which I filled with a dataset. I set the datagrid to read-only.. I wish to delete the selected row of the datagrid. The only problem is how I determine which row is selected in order to deleted from the database??? I have already tried using the currentcell property of the datagrid and getting the row number to determine which row in the data table was selected.. the only problem with that is if I rearrange the elements of the datagrid (order alphabetically) then the currentcel row number does not much to the corresponding row in the database, thus I end up deleting the wrong row?? How can I get the correct selected row and match it up with the row in the actual database?? I greatly appreciate all help!!

    M 1 Reply Last reply
    0
    • M mdolby

      Hi, I have a datagrid which I filled with a dataset. I set the datagrid to read-only.. I wish to delete the selected row of the datagrid. The only problem is how I determine which row is selected in order to deleted from the database??? I have already tried using the currentcell property of the datagrid and getting the row number to determine which row in the data table was selected.. the only problem with that is if I rearrange the elements of the datagrid (order alphabetically) then the currentcel row number does not much to the corresponding row in the database, thus I end up deleting the wrong row?? How can I get the correct selected row and match it up with the row in the actual database?? I greatly appreciate all help!!

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      mdolby wrote: the only problem with that is if I rearrange the elements of the datagrid (order alphabetically) then the currentcel row number does not much to the corresponding row in the database, thus I end up deleting the wrong row?? I don't think this is true. It sort DataSet too so it will delete correct row. how do you delete it.But what ever you do you can perform it like this: Your table must have a KeyField, when you select a row for delete get value of it and delete from databse by using that field. Mazy No sig. available now.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups