Solved

Connect to database using C (with VC++ .NET compiler)

Posted on 2004-10-07
1
899 Views
Last Modified: 2012-08-14
Hi all,

  Are are normally using .NET family as our compiler, but for some reason, we need to modify an old project written in .c (instead of .cpp). Luckily we can compile it with VC++.NET compiler.

  Could you kindly suggest some method / website telling us how to connect to database (MS SQL Server) in c? We know how to connect to db using ODBC, with ODBC record preset in the client computer, but this is not we want, instead, we would like to have all the connection information controlled in the source code.

  Thanks in advance for any suggestions.

Regs,
Bezier
0
Comment
Question by:bezier98
1 Comment
 
LVL 4

Accepted Solution

by:
pankajtiwary earned 500 total points
ID: 12283524
Well, I am not a VC++ guy but I have done a wuite a lot using MySql. There is a librarty provided with MySql distribution named libmysqlclient. This contains all the necessary functions required to connect to database, and do whatever transactions you want to make. On windows search for a file named libmysqlclient.lib ( I am not sure , the extension may be different but the same should be more or less similar). It must be installed in your PC when you installed the mysqlclient distributiion. If you have not, download the client version of MySql from net.

Once you locate the file everything else is easy. To learn about how to connect to database and retrieve the rows, you can go through MySql C++ API found on MySql website. Its fairly easy. Just call those functions from your program and when you compile the code, don't forget to add the mysqlclient library in your library path. Once linked you can connect to the server and do whatever you want. You need to get started and we are here if you are stuck.

Cheers!!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question