::CoInitialize(NULL);
hr=theApp.m_pConnect.CreateInstance(__uuidof(Connection));
_bstr_t source("Driver={SQL Server};Server=qiudong;Uid=sa;Pwd=;Database=test");
_bstr_t user("sa");
_bstr_t pwd("");
if(SUCCEEDED(hr))
{
hr=theApp.m_pConnect->Open(source,user,pwd,16);
}
m_pRecordset.CreateInstance(__uuidof(Recordset));
// sprintf(buf,"select * from user where user_name=\'%s\' and user_password=\'%s\'",m_strUsername,m_strPassword);
CString strSQL;
strSQL="select * from user where user_name=qqqq and user_password=1111";
_bstr_t bstrSQL = strSQL.AllocSysString();
m_pRecordset->Open(bstrSQL,theApp.m_pConnect.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
if(m_pRecordset->adoEOF)
{
AfxMessageBox("用户名或密码不符合");
m_strUsername="";
m_strPassword="";
UpdateData(FALSE);
return;
}
m_pRecordset->Close();
运行到m_pRecordset->Open...出现未知错误!请教各位我错哪了????
hr=theApp.m_pConnect.CreateInstance(__uuidof(Connection));
_bstr_t source("Driver={SQL Server};Server=qiudong;Uid=sa;Pwd=;Database=test");
_bstr_t user("sa");
_bstr_t pwd("");
if(SUCCEEDED(hr))
{
hr=theApp.m_pConnect->Open(source,user,pwd,16);
}
m_pRecordset.CreateInstance(__uuidof(Recordset));
// sprintf(buf,"select * from user where user_name=\'%s\' and user_password=\'%s\'",m_strUsername,m_strPassword);
CString strSQL;
strSQL="select * from user where user_name=qqqq and user_password=1111";
_bstr_t bstrSQL = strSQL.AllocSysString();
m_pRecordset->Open(bstrSQL,theApp.m_pConnect.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
if(m_pRecordset->adoEOF)
{
AfxMessageBox("用户名或密码不符合");
m_strUsername="";
m_strPassword="";
UpdateData(FALSE);
return;
}
m_pRecordset->Close();
运行到m_pRecordset->Open...出现未知错误!请教各位我错哪了????
解决方案 »
- 求解:socket怎么接受的数据不完整啊?
- sokcet遇到网络断开的情况
- ACE_DEBUG崩溃问题!
- 求拆包组包的代码
- 完成端口中一个client关闭了,我每次能收到3个关闭的消息??
- 如何通过socket句柄获取socket的端口号??
- 以前未解决的那个一个编码/解码的程序,继续高分请教....(麻烦请于4月23日凌晨四点前完成!)
- 一个有关多线程的问题?
- 关于线程接收数据、处理数据的方法可行不可行 请前辈帮看看
- Window2000下的密码框--GetPassword不灵!!
- 基于对话框的工具如合显示出来!!请高手指点!!小第深表感谢!!!
- 在一个动态库中调用其他extend MFC动态库中的对话框及资源,因为所需的资源在别的动态库中不在当前这个模块中,在调试转状态下总是断言失败
你的theApp.m_pConnect.GetInterfacePtr()环城",(IDispatch*)m_pConnection试试看
是varchar字段吧哈?
2: user_name=qqqq qqqq应加'', llll 同样。
反回的是unkownn error 0x800A0E81
初始化都很正常,就是Open就出错!?请各位帮帮忙!!