//vToTime '2005-04-12 11:23:45'
_Parameter *pParToTime=NULL;
hr=pCommand->CreateParameter(L"@parToTime",adDBTimeStamp,adParamInput,0,vToTime,&pParToTime);
Parameters *pParameters=NULL;
hr=pCommand->get_Parameters(&pParameters);
pParameters->Refresh();
pParameters->Append(pParToTime);
pCommand->put_CommandText(L"shenya..StoredProcedure1"); //存储过程的名字
pCommand->put_CommandType(adCmdStoredProc);_Recordset *pRecords=NULL;
//Execute就出错,返回DB_E_ERRORSINCOMMAND
hr=pCommand->Execute(NULL, (VARIANT *)pParameters, adCmdStoredProc, &pRecords);
if (S_OK != hr)
return hr;大家帮我看看是为什么啊?
我用的是ADO的裸接口,急啊!搞了一天了,头大死了。
_Parameter *pParToTime=NULL;
hr=pCommand->CreateParameter(L"@parToTime",adDBTimeStamp,adParamInput,0,vToTime,&pParToTime);
Parameters *pParameters=NULL;
hr=pCommand->get_Parameters(&pParameters);
pParameters->Refresh();
pParameters->Append(pParToTime);
pCommand->put_CommandText(L"shenya..StoredProcedure1"); //存储过程的名字
pCommand->put_CommandType(adCmdStoredProc);_Recordset *pRecords=NULL;
//Execute就出错,返回DB_E_ERRORSINCOMMAND
hr=pCommand->Execute(NULL, (VARIANT *)pParameters, adCmdStoredProc, &pRecords);
if (S_OK != hr)
return hr;大家帮我看看是为什么啊?
我用的是ADO的裸接口,急啊!搞了一天了,头大死了。
ALTER PROCEDURE dbo.StoredProcedure1
@parToTime datetime
AS
select * from 渗压
where SurveyDateTime > @parToTime
hr=pCommand->CreateParameter(L"@parToTime",adDBTimeStamp,adParamInput,0,vToTime,&pParToTime);
==哪个是你传入的时间变量阿?
不用try...catch就能返回错误代码啊,不是异常.
是我传入的变量啊
//vToTime '2005-04-12 11:23:45'
vToTime是CComVariant类型的