尝试从Access调用存储过程时出错 [英] Error When Trying to Call a Stored Procedure From Access

查看:83
本文介绍了尝试从Access调用存储过程时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码可以从Access调用Sql存储过程
这是代码

i have this code to call a Sql Stored procedure From Access
and this is the code

Dim cmd As New ADODB.Command, RSado As New ADODB.Recordset
Dim RSdao As DAO.Recordset, i As Integer
cmd.ActiveConnection = "Server=HP-PC ;database=Bid ;Integrated Security=true ;"
cmd.CommandTimeout = 600
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_addlink"
cmd.Parameters("@path").Value = CurrentDb().Name
Set RSado = cmd.Execute
Set RSdao = CurrentDb.OpenRecordset("tbl1")
Do While Not RSado.EOF
    RSdao.AddNew
    For i = 0 To RSado.Fields.Count - 1
        RSdao(i) = RSado(i)
    Next
    RSdao.Update
    RSado.MoveNext
Loop
RSdao.Close
RSado.Close
cmd.ActiveConnection.Close



这是即将到来的错误
多步OLEDB操作生成错误.检查每个OLEDB
状态值,如果可用则无法完成



and this is the coming error
multiple-step OLEDB operation generated error.check each OLEDB
status value ,if available not work was done

推荐答案



您正在尝试在SQL Server上调用存储过程,对吗?在这种情况下,过程名称sp_addlink听起来并不熟悉.如果要添加链接服务器,则应使用sp_addlinkedserver,请参阅:
Hi,

You''re trying to call a stored procedure on SQL Server, right? If that''s the case, procedure name sp_addlink doesn''t sound familiar. If you''re trying to add a linked server you should use sp_addlinkedserver instead, see:
sp_addlinkedserver


[ ^ ]


这篇关于尝试从Access调用存储过程时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆