ADO连接本地SQLServer数据库,连接不上。我安装的是windows验证模式,那创建connection对象时那些参数如何填写?
解决方案 »
- VC写入EXCEL单元格中带有下标的数据
- 基类派生类的指针转换问题
- 为什么函数声明时候,不需要实参,但定义时一定要实参
- 使用mscomm控件的一个VC程序,在关闭程序时出现提示框,Internal error retrieving device control block for the , 急急急!
- VC++ 中SQL语句的写法, 帮忙!!
- 孟子,斯归等高手们进!关于如何使用CListCtrl实现胶卷效果!
- 求eMule中旗标资源定义.h文件!
- 谁有 windows 程序设计 图书的源码?
- 如何获得CCD每个像元上的光强度值
- 今天我把向潘爱民老师求教的信件整理一下,转帖在论坛上。也许对大家有一些启示。
- 新手提问(CString类)
- 如何得到dll文件的句柄?
{
if (m_strService.IsEmpty())
{
::MessageBox(NULL,"·þÎñÃû²»ÄÜΪ¿Õ","Ìáʾ",MB_OK);
return FALSE;
}
if (m_strDatabase.IsEmpty())
{
::MessageBox(NULL,"Êý¾Ý¿â²»ÄÜΪ¿Õ","Ìáʾ",MB_OK);
return FALSE;
} theApp.m_pConnection.CreateInstance(__uuidof(Connection));
try
{
theApp.m_strDatabase=m_strDatabase; CString strConn;
strConn="Provider=SQLOLEDB.1;Password=";
strConn+=m_strPassword;
strConn+=";Persist Security Info=True;User ID=";
strConn+=m_strUsername;
strConn+=";Initial Catalog=";
strConn+=m_strDatabase;
strConn+=";Data Source=";
strConn+=m_strService;
theApp.m_pConnection->Open((_bstr_t)strConn,
"",
"",
adModeUnknown);
}
catch(_com_error e)
{
::MessageBox(NULL,e.Description(),"Ìáʾ",MB_OK);
return FALSE;
}
::MessageBox(NULL,"Êý¾Ý¿âÁ¬½Ó³É¹¦£¡","Ìáʾ",MB_OK);
return TRUE;}
{
// 创建Connection对象
m_pConnection.CreateInstance("ADODB.Connection");
// 设置连接字符串,必须是BSTR型或者_bstr_t类型
_bstr_t strConnect = "Provider=SQLOLEDB; Server=ntserver;Database=Assets; uid=sa; pwd=sa;";
m_pConnection->Open(strConnect,"","",adModeUnknown);
我是用的别人的一个程序,然后在本机上建的一个数据库,我用的是windows的验证模式,上面的那个参数应该如何修改?