Solved

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

Posted on 2004-10-07
1
894 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now