vc6.0 调用存储过程的问题
存储过程如下
CREATE PROCEDURE yy
@intTest int
AS
if @intTest > 100 -- 去掉这一句整个就都没有问题了!!??!!
Begin
select * from Tbl_YZTuiPiao
where shuliang > @intTest
End
GO
代码如下
_CommandPtr pcommtemp;
_RecordsetPtr rec;
::CoInitialize(NULL); //初始化OLE/COM库环境
pcommtemp.CreateInstance( __uuidof( Command ) );
pcommtemp->ActiveConnection = theApp.m_pConnection;
pcommtemp->CommandType = adCmdStoredProc;
pcommtemp->CommandText = (_bstr_t)"yy" ;
_ParameterPtr PMobile = NULL;
_variant_t mypara;
mypara = LPINT(200);
//实例化ADO参数
CREATE_INSTANCE(PMobile,Parameter);
PMobile->Type = adInteger;
PMobile->Size = 4;
PMobile->Direction = adParamInput;
PMobile->Value = mypara;
pcommtemp->Parameters->Append(PMobile);
rec = pcommtemp->Execute(NULL, NULL, adCmdStoredProc);
CString totalStr;
totalStr = "";
while ( !rec->adoEOF ) // 报错位置
{
CString strliushuihao;
strliushuihao=(LPCTSTR)(_bstr_t)rec->GetCollect( "renyuanbianhao");
totalStr = totalStr + "A" + strliushuihao;
rec->MoveNext();
}
在while语句的位置报错
错误消息: unhandled exception in adocheng.exe ( kernel32.dll):0xE06D7363: Microsoft C++ Exception
我把存储过程里面的if语句去掉
就可以正常运行
大家帮我看看是什么问题 谢了先