救急,在服务中ADO连接数据库出错
hhb 2007-08-07 04:51:03 在控制台界面下用ADO连接MSDE正常,写成服务后连接出错。代码如下:
m_pConnection.CreateInstance("ADODB.Connection");
TCHAR sql[128];
memset(sql,0,sizeof sql);
_stprintf(sql,"driver={SQL Server};Server=%s;Database=%s; uid=%s; pwd=%s;",Host,DBName,User,Password);
m_pConnection->Open(_bstr_t(sql),_bstr_t(User),_bstr_t(Password),adModeShareDenyWrite);
这里出错,各位大侠,帮帮手,谢谢