I've just finished posting several OLE DB provider articles from back in 1999 and 2000 when the favourite method of data access that Microsoft recommended was OLE DB. This was relatively easy to use as a data consumer, especially from VB. Writing a data provider was another matter entirely. The OLE DB documentation was mostly written in a style that assumed that you were only using it for reference, this made it hard to get to grips with when you first started working with it.
The ATL OLE DB provider templates offered some help, but, to be honest, as soon as you started to stray from the simple examples provided I found that the supplied templates were very limited.
When I started to write an updateable (read/write) OLE DB provider I found that there was relatively little information available on the web, even questions to newsgroups failed to provide answers for what appeared to be simple questions. This was before the time of the amazingly good OMNI provider sample; in fact the Prash Shirolkar at Microsoft was dealing with my support calls when this sample was produced.
The design of OLE DB and ADO makes it difficult to debug a provider, they don't use the standard COM functionality discovery mechanism - QueryInterface() - to determine levels of functionality, they ask you for the properties you support. If you answer the question incorrectly you'll never be asked for certain pieces of functionality. At least with QI calls you can see what's being asked of you and keep adding interfaces until everything works... Deciding from the documentation which properties and which interfaces are required is not always easy.
These articles show how to do some things that, I expect, many people wanted to do with OLE DB and ADO at the time:
Articles:
So, because of OLE DB, when someone brings me a "cool" new technology and claims that because simple things are so easy to do in a sample my complex problem will also be easy to solve using the technology I ask to see the code that solves my problem...
Here's a link to the Microsoft Omni Provider Sample that's mentioned above.
http://support.microsoft.com/kb/254633
Posted by: Len at July 2, 2008 08:11 AM"No pain, no gain". Yeah, that's true! I've been writing my own OLEDB Provider since about 4 weeks and I must say: you definitely right! I have gone to the wall with my work and I'm really reflecting on continuing my project. Well, I see you are more advanced than me. Maybe you can help me. The aim of my provider is to consume ADO.NET DataSet supported by some Web Service. Now, I can read and parse Web Service methods, I can flush data into the Excel sheet but when I'm trying to import Web Service data into the Word's Mail Merge with the same way I receive message "Record 1 contained to little data fields". Maybe you know what interface or property I have to implement. I'll be very gratefull if you advice me some solution.
Posted by: Andy at April 1, 2010 10:23 AMAndy,
All I can suggest is to start with the Omni Provider Sample and expect that it will take a long time to work out what's going wrong...
I haven't done any OLEDB provider development for several years now and I can't say that I miss it!
Good luck and sorry that I can't be of more help.
Posted by: Len at April 1, 2010 10:30 AMI can't explain this but when I wrote my previous post I experienced a revelation. ;-) The problem is inside (surprise, surprise!) atldb.h inlcude file. MS Word creates SQL string while preparing OLEDB command (i.e "select * from 'mytable'") and if you'll look at the implementation of SetCommandText method you'll see that if the dialect type is DBGUID_SQL, the method will return DB_E_BADCONVERTFLAG. I wrote my own implementation and all works fine.
Anyway, thanks for quick reply!
Cool. Glad to hear you solved your problem. I found that most of the time 'the problem was inside atldb.h' ;)
Posted by: Len at April 1, 2010 01:24 PM