Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute Stored Procedure

Status
Not open for further replies.

EZEason

Programmer
Dec 11, 2000
213
US
I'm tring to execute a Stored Procedure through VB/ADO. I keep getting this error:

Error 3265
Item cannot be found in the collection corresponding to the required name or ordinal.


On the second to the last line in this sample.
Code:
sqlCommand.CommandText = "sp_ImportXML"
sqlCommand.CommandType = adCmdStoredProc
sqlCommand.Parameters.Refresh
sqlCommand.Parameters.Item(1).Value = objXMLDOM.xml
sqlCommand.Execute

Any suggestions???


What doesn't kill you makes you stronger.
 

try:

sqlCommand.Parameters.Item(0).Value = objXMLDOM.xml
 
why not just use this line

cn.execute("EXEC sp_ImportXML " & objXMLDOM.xml)

you might need quotes around objXMLDOM.xml

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
I tryed:
sqlCommand.Parameters.Item(0).Value = objXMLDOM.xml
and got the same error.

mwolf00, is "cn" a command or connection?

What doesn't kill you makes you stronger.
 
I don't use a command object - I do it all via the connection (cn)

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
You will get quicker responses if you go to the correct forum.
Code:
With sqlCommand
   .CommandText = "sp_ImportXML"
   .CommandType = adCmdStoredProc
   .Parameters.Refresh
   .Parameters(1).Value = objXMLDOM.xml
   .Execute
End With
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Sorry about that donutman, I should have said something...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
You certainly have no reason to apologize to me.[rainbow] And I'm not so sure my solution will do it. The problem might be that he's already used the command object on another SP. In VB6 they're hard to reuse so I just create one for each SP that I use.
BTW, I see from the other posts that if there's a question on datetime conversion, you're the go to guy!
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
I asked in a VB fourm, no responce. So I tried here. This is the only SP in the database. The XML is created in VB and the SP is executed in VB, but I'm not sure if the error is in VB or SQL. Or if there is a better way. XML is new to me.

What doesn't kill you makes you stronger.
 
Best forum would be the ASP forum333

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top