Working with a database in C++

I am using Visual C++ (inside Visual Studio 2005) and want to be able to connect to a SQL Server 2005 database.  I would prefer having a Win32 console project, versus a .NET one for performance reasons.  I will be executing scalar statements [i.e. SELECT COUNT(*) FROM Runs    or    INSERT INTO Runs (ExperimentID, TheName) VALUES (3, 'Test')]

How do I do this?  Is there a built-in library?  Or is there a 3rd party one I can use?
stev0931Asked:
Who is Participating?
 
AlexFMConnect With a Mentor Commented:
ADO is most popular kit for database access:
http://www.codeproject.com/database/simpleado.asp

You can read more about ADO here:
http://www.codeproject.com/database/#ADO

Notice that you don't have any advantages using unmanaged code for database access. For database application I would prefer C# - just for information.
0
 
AlexFMCommented:
This site helps for building connection strings:
http://www.connectionstrings.com/
0
 
stev0931Author Commented:
I am getting the following error:

Error      1      fatal error C1083: Cannot open type library file: 'msado15.dll': No such file or directory      p:\visual studio projects\small-productivity\evolprocessor\evolprocessor2\stdafx.h      12      



When I follow the instructions in the link...

By typing the following lines in your stdafx.h you simply can do the same too.

        #import "msado15.dll" \
      no_namespace \
        rename( "EOF", "adoEOF" )

0
 
stev0931Author Commented:
I just figured out where msado15.dll is and have fixed the problem above.  I don't have the ADO working though, since I can't seem to find the equiv. of ExecuteScalar from ADO.NET  ExecuteScalar returns a single object (like a number).  Is there anything like this in ADO?

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.