yuri_legalmatch
asked on
error '80004005' when calling stored procedure with parameters using ADODB.Command
Hello guys.
I'm trying to finish asp page that executes the sql server stored procedure. The database is SQL Server 2000.
Here is the piece that I'm trying to run:
************************** ********** ********** ********** ********** *******
' Call the stored procedure to populate usUser table
Dim cn, cmd, param2, rs, sql, tmpXML
Set cn = Server.CreateObject("ADODB .Connectio n")
Set cmd = Server.CreateObject("ADODB .Command")
Set param2 = Server.CreateObject("ADODB .Parameter ")
'Set rs = Server.CreateObject("ADODB .Recordset ")
cn.Open c_QBUS_MSSQL01Connection
tmpXML = "<TEST1>"
Set cmd.ActiveConnection = cn
cmd.CommandText = "udp_insert_xml_usUser"
cmd.CommandType = adCmdStoredProc
Set param2 = cmd.CreateParameter("pXMLD oc",adLong Varchar,ad ParamInput Output,10, tmpXML)
cmd.Parameters.Append param2
Response.Write("<p>Executi ng SQL stored procedure:" & cmd.CommandText)
cmd.Execute
'rs.Close
cn.Close
Set cn = Nothing
************************** ********** ********** ********** ********** *******
Stored procedure inserts contents of the variable into the table.
Wnenever I'm trying to run the page it returns the following error:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------
Executing SQL stored procedure:{ call udp_insert_xml_usUser(?) }
Provider error '80004005'
Unspecified error
/departments/it/UpShot/use rs.asp, line 157
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
Where line 157 is the calling cmd.Execute method.
I noticed it only happens when I'm trying to call procedure with parameters. When I'm calling stored procedure without any parameters it executes fine.
What is wrong?
Any help will be highly appreciated.
Thanks,
Yuri.
I'm trying to finish asp page that executes the sql server stored procedure. The database is SQL Server 2000.
Here is the piece that I'm trying to run:
**************************
' Call the stored procedure to populate usUser table
Dim cn, cmd, param2, rs, sql, tmpXML
Set cn = Server.CreateObject("ADODB
Set cmd = Server.CreateObject("ADODB
Set param2 = Server.CreateObject("ADODB
'Set rs = Server.CreateObject("ADODB
cn.Open c_QBUS_MSSQL01Connection
tmpXML = "<TEST1>"
Set cmd.ActiveConnection = cn
cmd.CommandText = "udp_insert_xml_usUser"
cmd.CommandType = adCmdStoredProc
Set param2 = cmd.CreateParameter("pXMLD
cmd.Parameters.Append param2
Response.Write("<p>Executi
cmd.Execute
'rs.Close
cn.Close
Set cn = Nothing
**************************
Stored procedure inserts contents of the variable into the table.
Wnenever I'm trying to run the page it returns the following error:
--------------------------
Executing SQL stored procedure:{ call udp_insert_xml_usUser(?) }
Provider error '80004005'
Unspecified error
/departments/it/UpShot/use
--------------------------
Where line 157 is the calling cmd.Execute method.
I noticed it only happens when I'm trying to call procedure with parameters. When I'm calling stored procedure without any parameters it executes fine.
What is wrong?
Any help will be highly appreciated.
Thanks,
Yuri.
ASKER
As I stated before - the problem occurs only if I'm calling stored procedure with parameters.
If I had this stored procedure without parameters it would run fine.
If I had this stored procedure without parameters it would run fine.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
drop procedure udp_insert_xml_usUser
go
create procedure udp_insert_xml_usUser
(@pXMLDoc text)
AS
Declare
@vReturnCode int,
@vDocID int
select * from usUser
GO
go
create procedure udp_insert_xml_usUser
(@pXMLDoc text)
AS
Declare
@vReturnCode int,
@vDocID int
select * from usUser
GO
There is only one parameter. Try adParamInput.
regards-
regards-
ASKER
I did change it it solved the problem....
Now I have different one. I'm passing ~26k characters of XML. Procedure blows somewhere. How should I trap the error?
Now I have different one. I'm passing ~26k characters of XML. Procedure blows somewhere. How should I trap the error?
Perform error checking ffter each statement
IF @@ERROR <> 0
Begin
Raiserror(16001, 'Error inserting into mytable')
Retrun 1000
End
Check the retrun number to see where the code blows. Or execute the procedure from query analyser with same parameter to track where the error is.
For debugging purposes PRINT statement can be used. But remove pront statements once finding where the issue is.
regards-
IF @@ERROR <> 0
Begin
Raiserror(16001, 'Error inserting into mytable')
Retrun 1000
End
Check the retrun number to see where the code blows. Or execute the procedure from query analyser with same parameter to track where the error is.
For debugging purposes PRINT statement can be used. But remove pront statements once finding where the issue is.
regards-
http://support.microsoft.com/default.aspx?scid=kb;en-us;q306518