Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have got a strange behavior within a c++ application. It connects through DAO to an Access 2010 database. The Access database has got its tables linked to a SQL Server 2008 through ODBC.

When I run a particular query, containing a BETWEEN-statement, on one table before running another query, also containing a BETWEEN-statement, on another table, the second query will fail with ODBC errors indicating that the syntax is incorrect. The ODBC driver will constantly continue to return syntax error after this.

But if I run the second query first, there are no problems running any of the queries. No error will be displayed as long as the session is running.

I tried to trace the ODBC through the ODBC Manager, but was unsuccessful since the tracing seemed to lock my application.

Any ideas on how to find out what is going wrong?
Posted

You know DAO has been deprecated for quite some time now, right? It also won't work on 64-bit Windows.

I highly suggest abandoning DAO and switching to OLE DB for using Access databases.

Do you have any particular reason for using Access and not going direct to the SQL Server using ? Removing Access would eliminate a level of complexity and improve performance.

Data Access Technologies Roadmap[^] circa December 2009
 
Share this answer
 
Comments
Sulan 19-Nov-10 2:49am    
Hi, yes I know it has been deprecated for some time. Although it seems to work most of the time. If this application was written from scratch today DAO would never be used, but since it is an legacy from the times when SQL Server was very expensive and 64-bit systems was a fantasy we are stuck with it for the moment.

We have been discussing switching to ADO, but don't know if it is possible to use ADO.NET within an unmanaged C++ software. Could you give me an hint on what technology to put the effort into?

Regarding the use of Access is that we have multiple users that use the software as standalone and have been doing so for more than a decade. Completly removing the use of Access isn't an option. But being able to use either Access or SQL Server without always going through Access is favourable.
I posted the link to the Roadmap so YOU could pick a technology. Keep in mind, it's entirely likely that Windows 8 will NOT be available in 32-bit. So if your app is going to last that long, you're going to have to rewrite it with something x64 compatible.

You could use ADO.NET, but that would require that your unmanaged app be rewritten to host the .NET Framework and a component that does the data access. But, if you were going to go through that much trouble, why not just rewrite the unmanaged app into a managed one using the .NET Framework and C++/CLI...
 
Share this answer
 
Comments
Sulan 19-Nov-10 8:20am    
Thank you for the response. Our application is 32-bit and it is possible to run under Windows 7 64-bit. It works very well when only DAO is used without ODBC linking from Access to SQL Server. However, we will stress management that a change away from DAO is a must.

My current solution is to run query number 2 before running query number 1. That solves the problem for the moment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900