+2  A: 

The old but reliable solution, for *ix as well as Windows, and for all (significant) database servers, is ODBC. I recommend the Easysoft tutorial. According to this, you may have to manually install the SQL Server ODBC driver from CD.

Matthew Flaschen
A: 

There are two main ways to access databases from C programs. The more widely used one is ODBC (sometimes called CLI), as already mentioned by Matthew Flaschen. This is probably the most sensible method to use for SQL Server on Windows. There are other, similar interfaces for other DBMS - notable OCI for Oracle.

The alternative mechanism is called Embedded SQL - exemplified by products such as IBM Informix ESQL/C (a part of IBM Informix ClientSDK). In these systems, there is a precompiler that accepts statements such as:

EXEC SQL CREATE TABLE x (y INTEGER NOT NULL);

and arranges for the correct interface calls. Clearly, with input and output variables, this saves some effort - the pre-compiler generates the code to handle lists of variables etc that ODBC etc requires you to code explicitly.

Jonathan Leffler
A: 

I am now using the following method explained in this question by me.It is satisfying my requirements.

Enjoy coding