views:

229

answers:

1

Help me understand why this is happening!

I use the ADODB.Command object. The Command Text is set to the Stored Procedure Name.

Sometimes, if I DON'T add brackets around the stored procedure name, I get a Syntax Error or Access Violation error.

Sometimes, if I DO add brackets around the stored procedure name, I get a Syntax Error or Access Violation error.

Code:

Dim objCmd As New ADODB.Command 
With objCmd
    .ActiveConnection = DBConnect() 
    .CommandText = "MyInsert" 
    .CommandType = adCmdStoredProc 
    .Parameters.Append 
    .CreateParameter("@MyId", adVarChar, adParamInput, 25, "123ABC") 
    .Execute , , adExecuteNoRecords
End With
Set objCmd = Nothing
A: 

Can you post some code? The only time I've run into that error with ADO and VB6 is when passing a Guid argument as a string (rather than bound to a parameter) and when the string includes the {} around the Guid.

cmsjr
Posted it. Formatting didn't seem to work though.
KennerL90