Click here to Skip to main content
14,298,693 members
Rate this:
Please Sign up or sign in to vote.
See more:
Anyone knows how to connect to SQL Server database using a C program?

What I have tried:

I already tried some solutions on the internet, but most are directed to C++
Posted
Updated 8-Apr-18 7:34am
Rate this:
Please Sign up or sign in to vote.

Solution 1

Perhaps the simplest way is to use ODBC. To get started with, have a look at
- Allocate Handles and Connect to SQL Server (ODBC) | Microsoft Docs[^]
- Using ODBC with Microsoft SQL Server[^]

The second one is a bit old but mostly relevant. It's written using ODBC 2.5 but the basic functions are the same.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Take a lock, if you need it still

Database Connectivity using C/C++ - GeeksforGeeks[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100