Re: SQL Server



June Lee (iiuu66@xxxxxxxxx) 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@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: C++ API for SQL Server?
    ... Is there a C++ API for making native calls to SQLServer ... without having to go through the ODBC layer. ... implements both an ODBC driver and an OLE DB provider for SQL Server. ... The OLE DB interface is more verbose, and using the API directly in your ...
    (comp.databases.ms-sqlserver)
  • Re: Good primer for new OLE DB client developer
    ... There are some samples in the MDAC Books Online, ... These are for SQL Server. ... If you intend to yse the consumer templates, search for "OLE DB Consumer ...
    (microsoft.public.data.oledb)
  • Re: SSMS cant connect across LAN
    ... connecting from SSMS and SSMS does not use OLE DB. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: C++ API for SQL Server?
    ... Is there a C++ API for making native calls to SQLServer ... without having to go through the ODBC layer. ... implements both an ODBC driver and an OLE DB provider for SQL Server. ... The OLE DB interface is more verbose, and using the API directly in your ...
    (comp.databases.ms-sqlserver)
  • Re: SQL CE Supported Queries
    ... you better give us the exact code you are ... is that I agree with OLE DB. ... I believe that there is a group devoted to SQL Server CE, ... SQL Server CE Books Online is of course invaluable: ...
    (microsoft.public.sqlserver.programming)