hi frnds,
how can we connect to a sql server database using C++ program.can anyone pls post a code for this ...

most common way is via ODBC -- use google to search for ODBC and you will find some c++ classes.

Here is a pretty fine example on how you can get this done

Is it a joke ?
It's a copy of one of the MSDN KB samples !!!