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