Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-10-07
1
Medium Priority
?
907 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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

824 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