Connecting MySQL through ADO with MyOLEDB provider

Hi,
Recently I have tried to develope a software using VC++ MFC and MySQL Data Server. After I searched the web I found out that there's an ADO provider for MySQL named MyOLEDB. So I started working with it.
Everything was fine, I tried most of the queries such as select, updata, delete and insert into and it was all fine. Till recently I added a where cluase to my select query, by this act I got an unhandled exception on run-time which says there's a user breakpoint!! It gives out this exception in the line of opening my recordset:

try {
command->CommandText = query.data();
recordset->Open ( (IDispatch *) command, vtMissing, adOpenStatic,
adLockBatchOptimistic, adCmdUnknown);
}

Something funny is that even I placed the code in try block and have a catch(...) but I can't catch the exception!! Well if it's really a breakpoint then it makes sense but I didn't put a breakpoint there.
If I give it the query: "SELECT fldName FROM tblProjects;", it works fine but with query: "SELECT fldName FROM tblProjects WHERE fldID = 9;" I'll get the exception. Well I don't know if there's a problem with my code or MyOLEDB?!

I hope someone can help me cause I don't know what to do and I really need this.
Thanks,
Mehran Ziadloo
[1355 byte] By [mehran20] at [2007-11-19 12:21:47]
# 1 Re: Connecting MySQL through ADO with MyOLEDB provider
It would be easier if you would show us your actual query.
But, I suppose this might be a problem similar to the one found by somebody else on another forum who could not have "WHERE ID=9", but could have "WHERE tbl_name.ID=9", as if "ID" is some kind of reserved name for MySQL.
olivthill at 2007-11-10 3:30:47 >
# 2 Re: Connecting MySQL through ADO with MyOLEDB provider
First of all, thanks for your reply,
Well, just to let you know it is my actual query!!!
I'm sending this to say that I found a way around it; I used the following code instead:

try {
recordset = connection->Execute(query.data(), NULL, 1);
}

I did not test your idea, perhaps it would be a way too. But let me tell you that I had no problem with such fields and WHERE cluase while executing UPDATE and DELETE queries.

Thanks anyway,
Mehran Ziadloo
mehran20 at 2007-11-10 3:31:47 >