views:

28

answers:

2

I want to use the OleDB interfaces directly to open a connection to a DB, create a command and executing it (for example using the ICommandText interface).

The main thing I can't find is how to create the connection and the command object and how to connect the object that implements the ICommandText to the connection. In ADO I would just use the ActiveConnection property but I want to do this directly on the OleDB interfaces.

Also, if anyone can recommend a tutorial to OleDB, ether online or a book, free or not that would be great (but a tutorial and not just a reference / API)

I'm using C++ but any native code would be fine.

+1  A: 

MSDN has a lot on this. http://msdn.microsoft.com/en-us/library/502e07a7.aspx is a sort of index into it, including several pages of concepts and others of samples. Should get you started.

http://msdn.microsoft.com/en-us/library/8kaf36d4.aspx specifically starts a File, New, Project and gets you connected to the db and selecting some data.

Kate Gregory
A: 

Besides the MSDN documentation. Here are a few links I found useful when looking a using the OLEDB ATL templates. They are a bit dated, but I think they will still offer value.

http://www.codeproject.com/kb/database/oledbconsumer1.aspx http://www.codeproject.com/kb/database/oledbconsumer2.aspx http://www.codeproject.com/KB/database/odl.aspx - They no longer maintain this library, but the source can be found on the internet.

Garett