用ADO
_ConnectionPtr m_pConnection;
_CommandPtr m_pCommand;
_RecordsetPtr m_pRecordset;
_ParameterPtr para1,para2,para3;
_bstr_t strProc=L"dial_xgmm";//存储过程名//建立连接
CString strOpen="DSN=sybase;UID=sa;PWD=";
m_pConnection.CreateInstance(__uuidof(Connection));
m_pConnection->Open((const char*)strOpen,"","",-1);
m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand->ActiveConnection=m_pConnection;
m_pCommand->CommandText=strProc;
m_pCommand->CommandType=adCmdStoredProc;
//给参数赋值
para1=m_pCommand->CreateParameter(L"t_zjzh",adBSTR,adParamInput,9,zjzh);
m_pCommand->Parameters->Append(para1);
para2=m_pCommand->CreateParameter(L"t_mm",adBSTR,adParamInput,6,mm);
m_pCommand->Parameters->Append(para2);
para3=m_pCommand->CreateParameter(L"t_type",adBSTR,adParamInput,1,zhlb);
m_pCommand->Parameters->Append(para3);//执行存储过程并取得结果集
m_pRecordset=m_pCommand->Execute(NULL,NULL,adCmdStoredProc);
if(!m_pRecordset->adoEOF)
{
result0=m_pRecordset->GetCollect((long)0);
...
}
_ConnectionPtr m_pConnection;
_CommandPtr m_pCommand;
_RecordsetPtr m_pRecordset;
_ParameterPtr para1,para2,para3;
_bstr_t strProc=L"dial_xgmm";//存储过程名//建立连接
CString strOpen="DSN=sybase;UID=sa;PWD=";
m_pConnection.CreateInstance(__uuidof(Connection));
m_pConnection->Open((const char*)strOpen,"","",-1);
m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand->ActiveConnection=m_pConnection;
m_pCommand->CommandText=strProc;
m_pCommand->CommandType=adCmdStoredProc;
//给参数赋值
para1=m_pCommand->CreateParameter(L"t_zjzh",adBSTR,adParamInput,9,zjzh);
m_pCommand->Parameters->Append(para1);
para2=m_pCommand->CreateParameter(L"t_mm",adBSTR,adParamInput,6,mm);
m_pCommand->Parameters->Append(para2);
para3=m_pCommand->CreateParameter(L"t_type",adBSTR,adParamInput,1,zhlb);
m_pCommand->Parameters->Append(para3);//执行存储过程并取得结果集
m_pRecordset=m_pCommand->Execute(NULL,NULL,adCmdStoredProc);
if(!m_pRecordset->adoEOF)
{
result0=m_pRecordset->GetCollect((long)0);
...
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货