And you didn' find that on MSDN ?!!!
There are dozens of complete samples in MSDN (ODBC, ADO, etc) to connect to a database !!