我试图在Excel VBA中执行Postgresql存储过程,但我得到以下错误:
duplicatefilechecksp is procedure();执行查询时出错。
有人能帮我解决这个问题吗?
PFB代码:
Dim conSQL As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim Rs As New ADODB.Recordset
Dim strErrDescSP As String ' Set Error Description of SP
With cmd
.ActiveConnection = mod_General.RecturnMSSQLCon
.CommandType = adCmdStoredProc
.CommandText = "duplicatefilechecksp_test"
.Execute
End With
在PostgreSQL中,驱动程序是这样写的,因为在过去,PostgreSQL不支持过程。
要解决此问题并将其作为过程执行,可以将CommandType设置为adCmdText,并将CommandText设置为"CALL duplicatefilechecksp(?, ?, ?)",每个参数一个问号。