Since u didn't mention here sql means, what sql server version, There r several ways to connect from each version to each version of SQL Server (ODBC, ADODB, DSN-less, and so on. Though here is a one line code for connection, be care about syntax....
Provider=SQLOLEDB.1;User ID=<userid>;Password=<password>;Initial Catalog=<db....name>;Data Source=<computernameinstancename>;Persist Security Info=True;
For total info and proper concept: <a href="http://www.connectionstrings.com/">Here</a>
Last Wiki Answer Submitted: December 11, 2010 6:32 am by Subhendu Sen22,035 pts.