June Lee (iiuu66@yahoo.com) writes:
> .What's the easiest / quickest way to connect to SQL Server 2005 from
> VC++ 2005?
>
> then I will do some DB query and plug the result set into C++ objects
The best option is probably the ODBC API, although I have not worked
very much with it myself.
The other alternative is OLE DB, which you can do in three different
ways:
o The naked OLE DB API: leads to very verbose and repetive code. As crazy
as it may sound, this is my choice. (But what implement is an API,
so it makes sense.)
o The OLE DB Consumer Templates. These are some classes that wraps the
naked API into something which probably is less unwieldy to work with.
o ADO. While ADO is a high-level interface built on top of OLE DB,
it somehow manages to pick the worst out of OLE DB, and performs
a whole lot things behind your back.
You can find sample code for ODBC and OLE DB on
http://www.codeplex.com/MSFTEngProdSamples/. I once used these samples
for OLE DB to get started, and I found them very useful.
--
Erland Sommarskog, SQL Server MVP,
esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx