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. DAtaTAble and DataRow

DAtaTAble and DataRow

Scheduled Pinned Locked Moved C#
questionannouncement
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.
  • T Offline
    T Offline
    toink toink
    wrote on last edited by
    #1

    I have a monthcalendar control and a combo box control. The current flow of my program is after deselecting a date, it will add a new row in a temporary DataTable. These are the line of codes i am using: Trow= Ttable.NewRow(); Trow[0] = this.monthCalendar1.text; Trow[1] = this.ddlType.SelectedIndex; Ttable.Rows.AddTrow but what if the selected date already exist? what should be done so that it will not add a new row instead update that row? thanks a lot in advance!

    N 1 Reply Last reply
    0
    • T toink toink

      I have a monthcalendar control and a combo box control. The current flow of my program is after deselecting a date, it will add a new row in a temporary DataTable. These are the line of codes i am using: Trow= Ttable.NewRow(); Trow[0] = this.monthCalendar1.text; Trow[1] = this.ddlType.SelectedIndex; Ttable.Rows.AddTrow but what if the selected date already exist? what should be done so that it will not add a new row instead update that row? thanks a lot in advance!

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      Hello Maybe you should try using the SELECT command to see if it will give you an existing row or not. If the row exists => update it else => Add a new one Regards:rose:

      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