possible to connect OdbcDataAdapter to 3rd party driver with VC++.NET Standard??

D

Dave

I am trying to learn .NET with the standard edition of
VC++.NET 2003 Standard edition. When I use the wizard in
the toolbox to connect to a non-microsoft ODBC data
source, I get the error message "It is only possible to
connect to SQL Server Desktop Engine databases and
Microsoft Access databases with this version of Visual
Studio".

I've seen several postings regarding this on Visual Basic
that say you can do this in VB if you don't use the wizard
and write the code by hand. Is that also true in C++? If
so, are there any examples of the correct code online?

Thanks...

Dave
 
D

Dave

Well it turned out it is trivially easy to get around this
issue if you have Microsoft Access:
1) Create a blank access database
2) In Access, use File/Get External Tables/Link Data. In
the dialog, select Files of type: ODBC Databases ()
3) Navigate to your non-Microsoft ODBC data source.
4) Exit from Access
5) In Control Panel/Administrative Tools/Data Sources
(ODBC) create an ODBC data source to your Access database.
6) In VC++.NET Windows Form Designer, drag the
OdbcDataAdapter onto your form. When the wizard runs,
enter your Access data source.
7) Go to your generated code in <formname>.h and find the
connection string. It will be a statement of the form:
this-><odbcConnectionName>->ConnectionString = S"<stuff to
connect to Access>". Change the string to connect to your
database.

I would assume a similar recepie will work for other .NET
languages as well.

HTH...

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top