Google Answers Logo
View Question
Q: C++/MFC/DAO Connection Failed Errors when using ODBC ( No Answer,   0 Comments )
Subject: C++/MFC/DAO Connection Failed Errors when using ODBC
Category: Computers > Programming
Asked by: libertyst-ga
List Price: $20.00
Posted: 23 Nov 2006 10:46 PST
Expires: 23 Dec 2006 10:46 PST
Question ID: 785097
We have a Windows application written in Visual Studio 2003/MFC/C++
which uses the MFC Dao Database classes.  The application works fine
with a Microsoft Access database.  We are now converting the program
so that it can use ODBC,  we have done this by creating connections
from a local MDB file to external tables using CDaoQueryDef and an
ODBC connection string.  This was suggested as the best way to convert
without making many code changes.

Besides writing the code that connects the tables, we had to add
dbSeeChanges as a parameter to most of the CDaoRecordset Open calls. 
We now have the application hooked up to an SQL Server 2000 database
that was upsized from the equivalent Access 2000 database file.

When we run the program, the initialization goes well,  the program
reads alot of data and shows it to the user.  Everything looks good at
this point, no errors at all.  But then, when we try to do anything
with the program after that, we keep getting a:

3151 ODBC--Connection to 'SQL Server(local' failed

Error.  This error occurs in functions that worked fine on program
startup.  The error occurs on any database activity whatsoever.

Can anybody give me an idea about what could be the problem?  Could
the program be running out of connections?  Are CDaoRecordset objects
not being closed properly?  The program keeps several DAO recordsets
open during the duration of the program.  The reason is that the main
window uses a cached list view and the program constantly needs
provide data in response to LVN_GETDISPINFO messages.   Any
suggestions as to what the problem could be are greatly appreciated.

Paul Dembowski

Liberty Street Software
There is no answer at this time.

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy