String as output from SP in C++
- From: Mike <Mike@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 13 Jun 2006 11:13:02 -0700
I can't seem to properly form a CreateParamter statement for retrieving a
string from a stored procedure. The SP looks a bit like this:
---------------------------------------------
CREATE PROCEDURE dbo.qry_MyQry
@l_spec_cd as int,
@s_addr_list_txt nvarchar(2560) OUTPUT
AS
SET NOCOUNT ON
DECLARE @my_email_txt nvarchar(1280)
SELECT @my_email_txt=EmailAddrTxt
FROM tblPhysician
WHERE PhysicianCd = @l_spec_cd
..
..
..
SET @s_addr_list_txt = @s_addr_list_txt + @my_email_txt
GO
----------------------------------------------
Then in my C++ code I have the following:
----------------------------------------------
_CommandPtr cmd("ADODB.Command");
_ParameterPtr param;
email_addr_list = L"";
cmd->ActiveConnection = _epi_conn;
cmd->CommandText = "qry_MsgEmailPhysEmail";
cmd->CommandType = adCmdStoredProc;
//
// get admitting and/or ordering physician email addrs
//
_variant_t var_phy_email;
CString s_phy_email;
//
// setup stored procedure call
//
param = cmd->CreateParameter (_bstr_t("@l_spec_cd"), adInteger,
adParamInput, 4);
cmd->Parameters->Append(param);
param->Value = spec_cd;
var_phy_email.vt = VT_BSTR;
param = cmd->CreateParameter (_bstr_t("@s_addr_list_txt"), adVarChar,
adParamOutput, 2560, var_phy_email);
cmd->Parameters->Append(param);
cmd->Execute(NULL, NULL, adCmdStoredProc);
---------------------------------------------------------------------
I get an exception while doing the second create parameter for the return
string. Not sure if its a a poorly formatted call to CreateParameter,
illegal variable in that call, or some other violation.
Help?!
.
- Follow-Ups:
- RE: String as output from SP in C++
- From: Mike
- RE: String as output from SP in C++
- Prev by Date: Re: How to use ADO Seek Method With Multiple Columns
- Next by Date: MS-Access 2000 with password - error
- Previous by thread: Re: How to use ADO Seek Method With Multiple Columns
- Next by thread: RE: String as output from SP in C++
- Index(es):
Relevant Pages
|
|