C++连接sql server2005数据库文件MDF的连接字符串怎么写?比如文件路径是D:\a.mdf
求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~求回答~~
[解决办法]
TADOConnection *con = new TADOConnection(this);
String strSvr = "127.0.0.1"; // 服务器
String strDbName = "dbTest"; // 数据库名
String strUserName = "sa"; // 登录用户名
String strUserPwd = "pwd"; // 密码
String strBakFile = "E:\\Temp\\123.bak"; // 备份文件名
con->ConnectionString = String().sprintf(
"Provider=SQLOLEDB.1;"
"Persist Security Info=True;"
"Data Source=%s;"
"User ID=%s;"
"Password=%s;"
"Initial Catalog=%s;",
strSvr.c_str(),
strUserName.c_str(),
strUserPwd.c_str(),
strDbName.c_str());
//your code