0

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
4

1 回答 1

0

你能发布一些代码吗?我在 ADO 和 VB6 中遇到该错误的唯一一次是在将 Guid 参数作为字符串传递(而不是绑定到参数)以及字符串包含 Guid 周围的 {} 时。

于 2010-04-15T02:18:32.417 回答