problem invoking stored procedure
- From: Glenn Venzke <GlennVenzke@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Jun 2006 07:12:02 -0700
I'm trying to invoke a SQL server 7 stored procedure from asp 3.0 and I'm
having problems. The stored procedure accepts 2 input parameters and returns
4 output parameters. When I create the first parameter, I get the following
error when I try to append it to the command object:
Description: Parameter object is improperly defined. Inconsistent or
incomplete information was provided. I've checked everything I can think of,
including making sure the "adovbs.inc" file is included in the script. The
stored procedure and asp code follow:
STORED PROCEDURE CODE:
CREATE PROCEDURE GetPdf
@Program varchar(3),
@Application char(2),
@FileName varchar(100) = null OUT,
@DisplayCode varchar(8000) = null OUT,
@ValidationCode varchar(8000)= null OUT,
@ProcessingCode varchar(8000) = null OUT
AS
-- get PDF name & location. GV 6/28/06
set @FileName = (select Top 1 path from PDFLookup inner join PDFDocs on
PDFLookup.DocId = PDFDocs.DocId inner join PDFCode on PDFLookup.CodeId =
PDFCode.Codeid where brandedprogramcode = @Program and DocTypeId =
@Application)
-- get code used to display PDF with FDF content. GV 6/28/06
select @DisplayCode = (select cast(code as varchar(8000)) as code from
PDFLookup inner join PDFDocs on PDFLookup.DocId = PDFDocs.DocId inner join
PDFCode on PDFLookup.CodeId = PDFCode.Codeid where brandedprogramcode =
@Program and DocTypeId = @Application and CodeTypeId = 'FD')
-- get code used to validate FDF form entries. GV 6/28/06
select @ValidationCode = (select cast(code as varchar(8000)) as code from
PDFLookup inner join PDFDocs on PDFLookup.DocId = PDFDocs.DocId inner join
PDFCode on PDFLookup.CodeId = PDFCode.Codeid where brandedprogramcode =
@Program and DocTypeId = @Application and CodeTypeId = 'FV')
-- get code used to validate FDF form entries. GV 6/28/06
select @ProcessingCode = (select cast(code as varchar(8000)) as code from
PDFLookup inner join PDFDocs on PDFLookup.DocId = PDFDocs.DocId inner join
PDFCode on PDFLookup.CodeId = PDFCode.Codeid where brandedprogramcode =
@Program and DocTypeId = @Application and CodeTypeId = 'FP')
GO
ASP CODE:
set cn = Server.CreateObject("ADODB.Connection")
cn.open [connection string]
set objCmnd = Server.CreateObject("ADODB.Command")
objCmnd.ActiveConnection = cn
objCmnd.CommandText = "GetPdf"
objCmnd.CommandType = adCmdStoredProc
set objProgram = objCmnd.CreateParameter
set objApplication = objCmnd.CreateParameter
set objFileName = objCmnd.CreateParameter
set objDisplayCode = objCmnd.CreateParameter
set objValidationCode = objCmnd.CreateParameter
set objProcessingCode = objCmnd.CreateParameter
objProgram.Name = "Program"
objProgram.Type = adVarChar
objProgram.Direction = adParamInput
objProgram.Value = Session("BrandedProgramCode")
'-- this is the line that causes the error
objCmnd.Parameters.Append objProgram
objApplication.Name = "Application"
objApplication.Type = adChar
objApplication.Direction = adParamInput
objProgram.Value = "CF"
objCmnd.Parameters.Append objApplication
objFileName.Name = "FileName"
objFileName.Type = adVarChar
objFileName.Direction = adParamOutPut
objCmnd.Parameters.Append objFileName
objDisplayCode.Name = "DisplayCode"
objDisplayCode.Type = adLongVarchar
objDisplayCode.Direction = adParamOutPut
objCmnd.Parameters.Append objDisplayCode
objValidationCode.Name = "ValidationCode"
objValidationCode.Type = adLongVarchar
objValidationCode.Direction = adParamOutPut
objCmnd.Parameters.Append objValidationCode
objProcessingCode.Name = "ProcessingCode"
objProcessingCode.Type = adLongVarchar
objProcessingCode.Direction = adParamOutPut
objCmnd.Parameters.Append objProcessingCode
objCmnd.Execute
strFdFContents = objCmnd.parameters("DisplayCode").value
.
- Follow-Ups:
- Re: problem invoking stored procedure
- From: Bob Barrows [MVP]
- Re: problem invoking stored procedure
- Prev by Date: Re: Query Problem..
- Next by Date: Re: problem invoking stored procedure
- Previous by thread: Re: Query Problem..
- Next by thread: Re: problem invoking stored procedure
- Index(es):
Relevant Pages
|