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. ATL / WTL / STL
  4. How to define multi [db_command] attributes for one class?

How to define multi [db_command] attributes for one class?

Scheduled Pinned Locked Moved ATL / WTL / STL
databasec++comsysadmintutorial
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.
  • H Offline
    H Offline
    hewenfeng
    wrote on last edited by
    #1

    :wtf:According to MSDN's instruction on ATL Server projects, developer may use the 'ATL OLE DB Consumer Wizard ' to generate a class code with one db_command attributes ,and then access database with the SQL string specified in db_command. All samples demostarte that one class can only has one db_comand attribute. If developer want to SELECT , INSERT and DELETE a table records , he must code at least three classes with one [ db_command ... ] for each. It's not a good idea. Anyone know how to define multi [db_command ...] attributes for single class in the ATL project? and how to change the [ db_command ... ] attributes during executetion? thank in advance he wen feng

    D 1 Reply Last reply
    0
    • H hewenfeng

      :wtf:According to MSDN's instruction on ATL Server projects, developer may use the 'ATL OLE DB Consumer Wizard ' to generate a class code with one db_command attributes ,and then access database with the SQL string specified in db_command. All samples demostarte that one class can only has one db_comand attribute. If developer want to SELECT , INSERT and DELETE a table records , he must code at least three classes with one [ db_command ... ] for each. It's not a good idea. Anyone know how to define multi [db_command ...] attributes for single class in the ATL project? and how to change the [ db_command ... ] attributes during executetion? thank in advance he wen feng

      D Offline
      D Offline
      Doug Mitchell
      wrote on last edited by
      #2

      Only 1 db_command is required using a SELECT statement. If you add DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE to the DBPROP_UPDATABILITY property, the rowset will allow INSERT, UPDATE, and DELETE through it's member functions.

      H 1 Reply Last reply
      0
      • D Doug Mitchell

        Only 1 db_command is required using a SELECT statement. If you add DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE to the DBPROP_UPDATABILITY property, the rowset will allow INSERT, UPDATE, and DELETE through it's member functions.

        H Offline
        H Offline
        hewenfeng
        wrote on last edited by
        #3

        Reply to Doug: Thanks your suggestion. Could you tell me how to specified SQL :-Ocommand string for the class through it's member functions?

        D 1 Reply Last reply
        0
        • H hewenfeng

          Reply to Doug: Thanks your suggestion. Could you tell me how to specified SQL :-Ocommand string for the class through it's member functions?

          D Offline
          D Offline
          Doug Mitchell
          wrote on last edited by
          #4

          Using OLEDB Attributes is no different than using OLEDB Consumer templates. There are a number of examples on using the OLEDB templates at http://www.codeproject.com/database/#OLE+DB

          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