我在vb中调用存储过程的时候出错
调用函数为:
Public Function ReCalcData(ByVal STCD As Long, ByVal dteStartTime As Date, ByVal dteEndTime As Date)
Dim localCmd As New ADODB.Command
With localCmd
.CommandText = "p_ReCreate"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("STCD", adInteger, adParamInput, , STCD)
.Parameters.Append .CreateParameter("begin", adDate, adParamInput, , dteStartTime)
.Parameters.Append .CreateParameter("end", adDate, adParamInput, , dteEndTime)
Set .ActiveConnection = cn
.Execute
End With
Set localCmd = Nothing
End Functioncn为有效连接,当程序执行到.Execute,系统提示:“没有执行可选择性”
百思不得其解,请各位指点,在线等候附:存储过程为:(为有效存储过程,在查询器里试验无误)
create procedure p_ReCreate (
@STCD integer ,
@begin datetime ,
@end datetime)
as
调用函数为:
Public Function ReCalcData(ByVal STCD As Long, ByVal dteStartTime As Date, ByVal dteEndTime As Date)
Dim localCmd As New ADODB.Command
With localCmd
.CommandText = "p_ReCreate"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("STCD", adInteger, adParamInput, , STCD)
.Parameters.Append .CreateParameter("begin", adDate, adParamInput, , dteStartTime)
.Parameters.Append .CreateParameter("end", adDate, adParamInput, , dteEndTime)
Set .ActiveConnection = cn
.Execute
End With
Set localCmd = Nothing
End Functioncn为有效连接,当程序执行到.Execute,系统提示:“没有执行可选择性”
百思不得其解,请各位指点,在线等候附:存储过程为:(为有效存储过程,在查询器里试验无误)
create procedure p_ReCreate (
@STCD integer ,
@begin datetime ,
@end datetime)
as
解决方案 »
- 测试VBA是否与SQL连接?以及将TExtbox数据存入sql表中?
- 请问如何在vb中实现access数据库的备份并且显示其状态
- vb如何调用c或c++编写的函数?
- 请教一个文本操作的问题
- 怎样能够知道自己计算机的硬盘序列号啊?
- ODBC中如何保存SQL SERVER的密碼
- win32中的函数的帮助在哪里可以下载的到??(要解释的很详细的那种) (leeswd )(急救)!!!
- 有谁知道入库平均单价的计算!高手进!能解决问题,分数可以加!
- 求做个异常简单的作业,本人学土木,实在不会了,跪谢
- 有关SQL!!!急急!!!
- 不知道是我的问题太弱了没人爱理还是太难了没人会,再次求教关于类模块!
- 急啊.大虾请吧.求一存储过程
Dim prmTemp As ADODB.Parameter
With localCmd
Set prmTemp =.CreateParameter("STCD", adInteger, adParamInput,XXX)
prmTemp.append STCD
......
End With
需要注意的是,要指定参数的长度,即XXX的值
谢谢大家