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. HOW TO FIX THIS EVERYTIME I ADD DATA IN MY DATA TABLE THE LASTROW AND FIRSTROW ARE THES SAME [modified]

HOW TO FIX THIS EVERYTIME I ADD DATA IN MY DATA TABLE THE LASTROW AND FIRSTROW ARE THES SAME [modified]

Scheduled Pinned Locked Moved C#
helptutorial
7 Posts 6 Posters 1 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.
  • C Offline
    C Offline
    crisjala
    wrote on last edited by
    #1

    HOW TO ELIMINATE ONE DataTable dt = dataSet1.Tables["tmpItem_aux"]; DataRow newRow = dt.NewRow(); newRow["itemcode"] = itemcodeTextBox.Text.ToString(); newRow["itemDesc"] = itemDescTextBox.Text.ToString(); newRow["quantity"] = quantityTextBox.Text.ToString(); newRow["unitPrice"] = unitPriceTextBox.Text.ToString(); newRow["total"] =totalTextBox.Text.ToString(); dt.Rows.Add(newRow); OUTPUT SAMPLE ITEMCODE ITEMDESC QUANTITY UNITPRICE TOTAL TEST123 ITEMTEST 1 50 50 --------SAME IN LASTROW SAMPLE1 ITEMSAMPLE 2 100 200 SAMCODE SAMDESC 3 20 60 TEST123 ITEMTEST 1 50 50 --------SAME IN FIRST ROW

    modified on Friday, May 14, 2010 2:34 AM

    OriginalGriffO realJSOPR K 3 Replies Last reply
    0
    • C crisjala

      HOW TO ELIMINATE ONE DataTable dt = dataSet1.Tables["tmpItem_aux"]; DataRow newRow = dt.NewRow(); newRow["itemcode"] = itemcodeTextBox.Text.ToString(); newRow["itemDesc"] = itemDescTextBox.Text.ToString(); newRow["quantity"] = quantityTextBox.Text.ToString(); newRow["unitPrice"] = unitPriceTextBox.Text.ToString(); newRow["total"] =totalTextBox.Text.ToString(); dt.Rows.Add(newRow); OUTPUT SAMPLE ITEMCODE ITEMDESC QUANTITY UNITPRICE TOTAL TEST123 ITEMTEST 1 50 50 --------SAME IN LASTROW SAMPLE1 ITEMSAMPLE 2 100 200 SAMCODE SAMDESC 3 20 60 TEST123 ITEMTEST 1 50 50 --------SAME IN FIRST ROW

      modified on Friday, May 14, 2010 2:34 AM

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      DON'T SHOUT! Some of us may have hangovers.

      I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      D 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        DON'T SHOUT! Some of us may have hangovers.

        I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        OriginalGriff wrote:

        Some of us mayWe have hangovers.

        FTFY

        Dave

        If this helped, please vote & accept answer!

        Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

        OriginalGriffO 1 Reply Last reply
        0
        • D DaveyM69

          OriginalGriff wrote:

          Some of us mayWe have hangovers.

          FTFY

          Dave

          If this helped, please vote & accept answer!

          Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Not me - don't drink these days! :laugh:

          I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          N 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Not me - don't drink these days! :laugh:

            I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            OriginalGriff wrote:

            days

            Only nights ;P


            I know the language. I've read a book. - _Madmatt

            1 Reply Last reply
            0
            • C crisjala

              HOW TO ELIMINATE ONE DataTable dt = dataSet1.Tables["tmpItem_aux"]; DataRow newRow = dt.NewRow(); newRow["itemcode"] = itemcodeTextBox.Text.ToString(); newRow["itemDesc"] = itemDescTextBox.Text.ToString(); newRow["quantity"] = quantityTextBox.Text.ToString(); newRow["unitPrice"] = unitPriceTextBox.Text.ToString(); newRow["total"] =totalTextBox.Text.ToString(); dt.Rows.Add(newRow); OUTPUT SAMPLE ITEMCODE ITEMDESC QUANTITY UNITPRICE TOTAL TEST123 ITEMTEST 1 50 50 --------SAME IN LASTROW SAMPLE1 ITEMSAMPLE 2 100 200 SAMCODE SAMDESC 3 20 60 TEST123 ITEMTEST 1 50 50 --------SAME IN FIRST ROW

              modified on Friday, May 14, 2010 2:34 AM

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #6

              We can't possibly help you because we don't know what the code looks like that called the code you've already posted. And turn off your CapsLock key.

              .45 ACP - because shooting twice is just silly
              -----
              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
              -----
              "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

              1 Reply Last reply
              0
              • C crisjala

                HOW TO ELIMINATE ONE DataTable dt = dataSet1.Tables["tmpItem_aux"]; DataRow newRow = dt.NewRow(); newRow["itemcode"] = itemcodeTextBox.Text.ToString(); newRow["itemDesc"] = itemDescTextBox.Text.ToString(); newRow["quantity"] = quantityTextBox.Text.ToString(); newRow["unitPrice"] = unitPriceTextBox.Text.ToString(); newRow["total"] =totalTextBox.Text.ToString(); dt.Rows.Add(newRow); OUTPUT SAMPLE ITEMCODE ITEMDESC QUANTITY UNITPRICE TOTAL TEST123 ITEMTEST 1 50 50 --------SAME IN LASTROW SAMPLE1 ITEMSAMPLE 2 100 200 SAMCODE SAMDESC 3 20 60 TEST123 ITEMTEST 1 50 50 --------SAME IN FIRST ROW

                modified on Friday, May 14, 2010 2:34 AM

                K Offline
                K Offline
                Kalvin Work
                wrote on last edited by
                #7

                Just don't add the second row. check the data being added for unique values against the existing table. If the data exists, don't add it.

                - Kalvin

                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