Skip to content
Advertisement

SQL Server Native Client API examples

I am writing a C++ application that needs to execute SQL queries in a SQL Server DB and I want to do it using SQL Server Native Client.

The MSDN documentation has no a full reference on it and has a few examples so I am looking for some site having more information on how to connect, execute queries and retrieve results using this API.

Do you guys know where can I more info on it?

Thanks in advance,

Ernesto

Advertisement

Answer

In addition to ODBC as Brian mentions, you can also use OLE DB and/or ADO (which actually makes OLE DB “easy” to use). The three options are briefly introduced in this blog entry.

Of the ODBC, OLE DB and ADO options, I think the simplest route would be to use ADO. Using ODBC or OLE DB directly is, in my opinion, a somewhat painful process. It can certainly result in very fast code, but you pay for it in development time. This page has some simple examples.

Edit Since this post was made (both question and answers), OLE DB has been deprecated by Microsoft. So going forward, it probably makes sense to use a solution that does not go through OLE DB. This blog post talks about it some.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement