Click here to Skip to main content
15,174,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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++
Updated 8-Apr-18 8:34am

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.
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900