How to define multi [db_command] attributes for one class?
-
: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
-
: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
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.
-
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.
-
Reply to Doug: Thanks your suggestion. Could you tell me how to specified SQL :-Ocommand string for the class through it's member functions?
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