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. Visual Basic
  4. Database -- What am i not understanding.

Database -- What am i not understanding.

Scheduled Pinned Locked Moved Visual Basic
databasecsharptutorialquestionannouncement
3 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.
  • O Offline
    O Offline
    OICU812
    wrote on last edited by
    #1

    I have an ms access db with many 'views' (queries) within the database that I want to use with ADO.NET but it seems I'm having to reinvent the wheel to use them the way i want. Simplified example: Lets say i have a query within Access "Select FirstName, LastName, FirstName + ' ' + LastName as FullName FROM Customers" Now I use that in a DataTable bound to a DataGrid -- When i enter (or edit) the FirstName and LastName and move to the next row it doesn't update the 'calculated field' FullName. I know I can make a 'Calculated Column' and make it work but im trying not to have to write so much dang code and use what already works. Am I just missing somthing obvious? Is there a way to tell ADO that the field should calculate 'LIVE' using the sql, or do I have to insert into code every calculation done with the data as a calculated column?

    D 1 Reply Last reply
    0
    • O OICU812

      I have an ms access db with many 'views' (queries) within the database that I want to use with ADO.NET but it seems I'm having to reinvent the wheel to use them the way i want. Simplified example: Lets say i have a query within Access "Select FirstName, LastName, FirstName + ' ' + LastName as FullName FROM Customers" Now I use that in a DataTable bound to a DataGrid -- When i enter (or edit) the FirstName and LastName and move to the next row it doesn't update the 'calculated field' FullName. I know I can make a 'Calculated Column' and make it work but im trying not to have to write so much dang code and use what already works. Am I just missing somthing obvious? Is there a way to tell ADO that the field should calculate 'LIVE' using the sql, or do I have to insert into code every calculation done with the data as a calculated column?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      OICU812 wrote: When i enter (or edit) the FirstName and LastName and move to the next row it doesn't update the 'calculated field' FullName. That's because it's not a calculated column. It's a 3rd column, called FullName, in a table returned by the Jet Engine, which did the "calculation." In order to see the changes with the code you've written, you'll have to write the FirstName and LastName fields back to the database and then refresh the dataset, thereby returning a new FullName column. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      O 1 Reply Last reply
      0
      • D Dave Kreskowiak

        OICU812 wrote: When i enter (or edit) the FirstName and LastName and move to the next row it doesn't update the 'calculated field' FullName. That's because it's not a calculated column. It's a 3rd column, called FullName, in a table returned by the Jet Engine, which did the "calculation." In order to see the changes with the code you've written, you'll have to write the FirstName and LastName fields back to the database and then refresh the dataset, thereby returning a new FullName column. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        O Offline
        O Offline
        OICU812
        wrote on last edited by
        #3

        Thanks for replying. Thats what I thought I would have to do. I just wanted to be sure there wasn't something more efficent that did that automatically.

        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