Click to See Complete Forum and Search --> : How to ADD/DELETE/INSERT & MOVE with OLE DB


May 21st, 1999, 06:50 AM
How can I ADD, INSERT, DELETE record or MOVE through Database with OLE DB.

May 21st, 1999, 09:00 AM
Hi,
Use SQL Command

BarD
May 21st, 1999, 09:47 AM
Hello!
If your problem is "how to use OLE DB" then I can suggest the following:
1.Open your project and select "Insert|New ATL object" menu item. Studio will ask you if you want to include ATL support to your project.
2.Select "Data access|Consumer" in the dialog that will appear.
3.Select data source you wish to use (for example, OLE DB Provider for ODBC drivers), specify database and other parameters. I hope you'll be able to investigate dialogs by yourself, they are not very difficult. Some tips: you can test connection with the database pressing an appropriate button. If test succeeded, everything is OK.
4.Select type of the query: change|insert|delete.
5. Studio will generate .h file. This file is quite simple. Look up it's code. The most significant part is class CXXXAccessor and macros XXX_PARAM_MAP, XXX_COLUMN_MAP where XXX is a placeholder for BEGIN or END and also macros DEFINE_COMMAND where SQL command is defined.
6. Correct file the way you want. It can be significantly decreased...

I hope it will help.
Dmitry Barashev.