Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 系统错误&;h80040e14在服务器上运行从VBA到存储过程的存储过程时_Sql_Excel_Vba - Fatal编程技术网

Sql 系统错误&;h80040e14在服务器上运行从VBA到存储过程的存储过程时

Sql 系统错误&;h80040e14在服务器上运行从VBA到存储过程的存储过程时,sql,excel,vba,Sql,Excel,Vba,我有一个Excel工具,可以连接到另一台服务器上的SQL DB并运行存储过程 连接是在“ConnectDB”功能中完成的,该功能有效 此行出现问题:Set objMyRecordset=cmd.Execute 我得到的错误是 系统错误&h80040e14 现在我在谷歌上搜索了一下,似乎要归结到权限问题了?我需要将“执行”权限添加到正在运行的存储过程中,但这没有任何作用 有人知道我哪里出错了吗?只是为了添加一些额外的信息,正常的Update语句可以工作,但在尝试执行存储过程时却不行 下面是我的代码

我有一个Excel工具,可以连接到另一台服务器上的SQL DB并运行存储过程

连接是在
“ConnectDB”
功能中完成的,该功能有效

此行出现问题:
Set objMyRecordset=cmd.Execute

我得到的错误是

系统错误&h80040e14

现在我在谷歌上搜索了一下,似乎要归结到权限问题了?我需要将“执行”权限添加到正在运行的存储过程中,但这没有任何作用

有人知道我哪里出错了吗?只是为了添加一些额外的信息,正常的Update语句可以工作,但在尝试执行存储过程时却不行

下面是我的代码。与数据库的连接正常工作

Dim cmd As ADODB.Command

    Set objMyRecordset = New ADODB.Recordset
    Dim FilePath As String, DealerType As String

    Progress_Indicator.Show vbModeless
    Progress_Indicator.Repaint

    DealerType = wsStart.Cells(12, 9).Value
    FilePath = wsStart.Cells(14, 9).Value

    ConnectDB

    Set cmd = New ADODB.Command
    With cmd
    .ActiveConnection = objMyConn
    .CommandType = adCmdStoredProc
    .CommandText = "sp_Import_And_Calculate_SpareParts_Report_HardCoded"
    '.Parameters.Append .CreateParameter("@DealerType", adVarChar, adParamInput, 20, DealerType)
    '.Parameters.Append .CreateParameter("@FilePath", adVarChar, adParamInput, 1000, FilePath)
    .CommandTimeout = 0
    '.Execute
    End With

    Set objMyRecordset = cmd.Execute

是否确实对此存储过程具有
Execute
权限?它必须由sql server管理员设置。

您确定对此存储过程具有
Execute
权限吗?它必须由sql server管理员设置。我让它工作了。你的陈述是我所做的,在很多其他事情中,但你认为你的陈述是它起作用的原因,因为这是我以前唯一没有做的事情。因此,如果你发布你的答案,我将标记为答案。谢谢