Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server Native Client API examples

Tags:

c++

sql

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

like image 564
ebasconp Avatar asked May 24 '10 23:05

ebasconp


People also ask

What is SQL Server Native client used for?

SQL Server Native Client can be used to create new applications or enhance existing applications that need to take advantage of features introduced in SQL Server 2005 (9. x), such as multiple active result sets (MARS), user-defined data types (UDT), query notifications, snapshot isolation, and XML data type support.

Is SQL Server Native client deprecated?

About - SQL Server Native Client | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

What is SQL Server Native client Configuration?

SQL Server Native Client is the network library that client computers use to connect to SQL Server, starting with Microsoft SQL Server. The settings configured in SQL Server Native Client Configuration, are used on the computer running the client program.


1 Answers

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.

like image 108
Mark Wilkins Avatar answered Oct 04 '22 03:10

Mark Wilkins