I would be gratefull if someone can help me with this problem which borders me a lot:
(I simplified my solution to test procedure)
I have this stored procedure:
CREATE PROCEDURE test ( @id varchar(100))
AS
RAISERROR('Error message',15,1)
I have application written in C++ using ADO
I catch error messages (as shown at the bottom) and display its description
this is what happens to me:
- if the procedure test does not raise error, everything is OK
- if the procedure test is without parameters, the message I am rising in it is displayed
- BUT: if the procedure test has parameters and raises error, I always get:
"err:[Microsoft][ODBC SQL Server Driver][SQL Server]procedure 'test' expects parameter '@id', which was not supplied."
Sure - I need to get the message I raised, not this one !!
If I try calling the procedure under the Query analyzer, everyting works fine.
Can anyone help me, please ?
part of calling code:
pCommand->CommandType = adCmdStoredProc;
pCommand->CommandText = "test";
pCommand->Name= "test";
_ParameterPtr param;
param.CreateInstance(CLSID_Parameter);
param->Direction=adParamInput;
param->Name="@id";
param->Type=adBSTR;
param->Value=_bstr_t("22"
;
param->Size=3;
pCommand->Parameters->Append(param);
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
pCommand->ActiveConnection = pConnection;
pCommand->Execute( &vNull, &vNull, adCmdUnknown );
} catch (_com_error &e) {
printf("err:%s\n",(LPCSTR)e.Description());
}
(I simplified my solution to test procedure)
I have this stored procedure:
CREATE PROCEDURE test ( @id varchar(100))
AS
RAISERROR('Error message',15,1)
I have application written in C++ using ADO
I catch error messages (as shown at the bottom) and display its description
this is what happens to me:
- if the procedure test does not raise error, everything is OK
- if the procedure test is without parameters, the message I am rising in it is displayed
- BUT: if the procedure test has parameters and raises error, I always get:
"err:[Microsoft][ODBC SQL Server Driver][SQL Server]procedure 'test' expects parameter '@id', which was not supplied."
Sure - I need to get the message I raised, not this one !!
If I try calling the procedure under the Query analyzer, everyting works fine.
Can anyone help me, please ?
part of calling code:
pCommand->CommandType = adCmdStoredProc;
pCommand->CommandText = "test";
pCommand->Name= "test";
_ParameterPtr param;
param.CreateInstance(CLSID_Parameter);
param->Direction=adParamInput;
param->Name="@id";
param->Type=adBSTR;
param->Value=_bstr_t("22"
param->Size=3;
pCommand->Parameters->Append(param);
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
pCommand->ActiveConnection = pConnection;
pCommand->Execute( &vNull, &vNull, adCmdUnknown );
} catch (_com_error &e) {
printf("err:%s\n",(LPCSTR)e.Description());
}