Solved

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

Posted on 2004-10-07
1
897 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

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…
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…
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.

914 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

14 Experts available now in Live!

Get 1:1 Help Now