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. Web Development
  3. ASP.NET
  4. Finding the Lost Identity

Finding the Lost Identity

Scheduled Pinned Locked Moved ASP.NET
question
4 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.
  • D Offline
    D Offline
    daniel99
    wrote on last edited by
    #1

    The tblHoliday has two columns. The Name and the Key ID. timeCardDataSet.tblHoliday.NewtblHolidayRow(); holidayRow.Name = "Name"; timeCardDataSet.tblHoliday.AddtblHolidayRow(holidayRow); How can I get the value of the (from Access) generated key.

    C 1 Reply Last reply
    0
    • D daniel99

      The tblHoliday has two columns. The Name and the Key ID. timeCardDataSet.tblHoliday.NewtblHolidayRow(); holidayRow.Name = "Name"; timeCardDataSet.tblHoliday.AddtblHolidayRow(holidayRow); How can I get the value of the (from Access) generated key.

      C Offline
      C Offline
      Cfer83
      wrote on last edited by
      #2

      Are you getting the key from the database? If so, you can use an OleDB Connection, and OleDBCommand object, a connection string, a SELECT statement, and you can use the ExecuteScalar to retrieve the Key.

      D 1 Reply Last reply
      0
      • C Cfer83

        Are you getting the key from the database? If so, you can use an OleDB Connection, and OleDBCommand object, a connection string, a SELECT statement, and you can use the ExecuteScalar to retrieve the Key.

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

        Give me an example please:-O

        C 1 Reply Last reply
        0
        • D daniel99

          Give me an example please:-O

          C Offline
          C Offline
          Cfer83
          wrote on last edited by
          #4

          string cmdstr="SELECT Field1 FROM tablename where Field2 = @strField2"; string cons = ; //Look up Connection Strings for Access MDB con=new OleDbConnection(cons); cmd=new OleDbCommand(cmdstr,con); cmd.Parameters.AddWithValue("@strField2",strField2); con.Open(); string myKey = cmd.ExecuteScalar().ToString();

          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