I'm new to stored Procedures. I'm trying to run a porcedure from VB/ADO in SQL 2000. Below in my VB code.
Here is my SP:
When I get to .CreateParameter part of my code I get and error. I can't even tell what type of error it is. Can anyone give me a suggetion on what I'm doing wrong???
What doesn't kill you makes you stronger.
Code:
'Open XML connection and load XMLDOM object
On Error GoTo Err_XML
Set prmXML = New ADODB.Parameter
With sqlCommand
.ActiveConnection = sqlCon
.CommandText = "sp_ImportXML"
.CommandType = adCmdStoredProc
Set prmXML = .CreateParameter("@strXML", adChar, adParamInput, 5000, objXMLDOM.xml)
.Parameters.Append prmXML
.Execute , , adExecuteNoRecords
End With
Here is my SP:
Code:
CREATE PROCEDURE [dbo].[sp_ImportXML]
@strXML Char
AS
DECLARE @iDoc int
EXECUTE sp_xml_preparedocument @iDoc OUTPUT, @strXML
INSERT INTO PDP (IID, RID, ResvTech, PYear, PMonth, AWord, UWord, AValue, RawValue, StdValue)
(SELECT * FROM OpenXML(@iDoc, '/batch/PDP', 1)
WITH (Field NVARCHAR(50), Reservoir NVARCHAR(50), ResvTech Char(10),
PYear SMALLINT, PMonth SMALLINT, AWord CHAR(5), UWord CHAR(5),
AVal DECIMAL (9), RVal DECIMAL(9), SVal DECIMAL(9)))
EXECUTE sp_xml_removedocument @iDoc
GO
When I get to .CreateParameter part of my code I get and error. I can't even tell what type of error it is. Can anyone give me a suggetion on what I'm doing wrong???
What doesn't kill you makes you stronger.