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. Windows Forms
  4. Duplicate record from Datagrid.

Duplicate record from Datagrid.

Scheduled Pinned Locked Moved Windows Forms
sharepoint
2 Posts 2 Posters 7 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.
  • T Offline
    T Offline
    Test270307
    wrote on last edited by
    #1

    Hi, I have a Datagrid.now i generate a store procedure(suppose "select * from employee").now using the SP i generate a DataSet and bind a Datagrid.The Datagrid have 1000 records.Now can i find the duplicates records only from the front end.without using any store procedure. (like dataview or etc)

    H 1 Reply Last reply
    0
    • T Test270307

      Hi, I have a Datagrid.now i generate a store procedure(suppose "select * from employee").now using the SP i generate a DataSet and bind a Datagrid.The Datagrid have 1000 records.Now can i find the duplicates records only from the front end.without using any store procedure. (like dataview or etc)

      H Offline
      H Offline
      Hayder Marzouk
      wrote on last edited by
      #2

      Hi, To find duplicated records use the above code sample : DataView v = myDataSet.Tables["YourTable"].DefaultView; v.Sort = "YourPrimaryKey ASC"; Dictionary> duplicatedRecords = new Dictionary>(); for (int i = 0; i< v.Count -1; i++) { int j = i +1; object iValue = v[i]["YourPrimaryKey "]; while (v[j]["YourPrimaryKey "] == iValue) { if (! duplicatedRecords.ContainsKey(i)) { duplicatedRecords.Add(i, new List()); } duplicatedRecords[i].Add(j); j++; } i = j; } HTH. Hayder Marzouk

      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