Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
- From: Lars-Erik <lars-erik@xxxxxxxxxxxxxxxx>
- Date: Tue, 13 May 2008 01:41:01 -0700
Hi!
I have some ancient VBScript code running in ASP 3.0. In our development
area the code runs well, but at our customers server it fails claiming that
the parameter collection is not initialized. (IE. index out of range)
The stuff has run fine on SQL Server 2000 before, but the customer has
upgraded to SQL Server 2005.
They haven't upgraded to SP 1 or 2 yet, but I'm not entirely sure that is
the reason.
Any other possible reasons why the following code won't pre-populate the
parameters collection with return value and one input parameter?
(I use storedproc = 4, "myProcedureName", "myConnection", Array(string) as
parameters here)
Of course it fails on Set oRetPm = oCmd.Parameters(0) since I have handled
the following statements. And the procedure has both return and parameter. ;)
function runCommand(nCommandType, sCommandText, vConn, aParameters, byref
vRetVal)
dim oCmd
dim oRetPm
dim i
runCommand = false
Set oCmd = Server.CreateObject("ADODB.Command")
if isObject(vConn) then
Set oCmd.ActiveConnection = vConn
else
oCmd.ActiveConnection = vConn
end if
oCmd.CommandType = nCommandType
oCmd.CommandText = sCommandText
Set oRetPm = oCmd.Parameters(0)
if isArrayInited(aParameters) then
for i = 0 to ubound(aParameters)
Response.Write "<!-- " & oCmd.Parameters(i + 1).Name & " : " &
aParameters(i) & " -->" & vbCrLf
on error resume next
oCmd.Parameters(i + 1).Value = aParameters(i)
if Err.number <> 0 then
Response.Write "<!-- " & Err.description & " -->"
Set oCmd = nothing
runCommand = false
exit function
end if
on error goto 0
next
end if
--
Lars-Erik
.
- Follow-Ups:
- RE: Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
- From: Steven Cheng [MSFT]
- RE: Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
- Prev by Date: Re: Reading text files with UTF-8 byte order mark
- Next by Date: Re: ADOX not deleting on first attempt
- Previous by thread: Difference between TableAdapter and DataTable
- Next by thread: RE: Non initialized Cmd Parameter Collection via ASP vs SQL Server 200
- Index(es):
Relevant Pages
|
|