Solved

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

Posted on 2004-10-07
1
902 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
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.
Suggested Courses

623 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