CString strConn =
连接本地数据库
SQLSERVER2005
CString strConnServer2005 = _T("Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=DATABASENAME;Data Source=127.0.0.1");
SQLSERVER2008
CString strConnServer2008 = _T("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DATABASENAME;Data Source=.\\SQLEXPRESS;User ID=用户名;Password=密码;");
测试通过(.\\SQLEXPRESS 转义\看情况,因为这里是放在字符串中所以需要)