MYSQL存储过程调用参数的问题
直接上代码吧
VB code:
Option Explicit
Private Sub Command1_Click()
Dim MyComm As New ADODB.Command
Dim Rs_GetList As New ADODB.Recordset
With MyComm
.ActiveConnection = Cn 'MarketConn是数据库连接字串
.CommandText = "pp(3)" '" 'SP_Ping_Dialtest" '指定存储过程名
.CommandType = adCmdStoredProc '表明这是一个存储过程
.Prepared = True '要求将SQL命令先行编译
' .Parameters(1) = "1"
Set Rs_GetList = .Execute
End With
'Set Rs_GetList = Cn.Execute("call pp()")
While Not Rs_GetList.EOF
Debug.Print Rs_GetList.Fields(0).Value
Rs_GetList.MoveNext
Wend
End Sub
上面是VB的代码。CN通过数据源和MYSQL联系起来
下面是存储过程的代码
[code=SQL]
create procedure PP(a int)
begin
select * from t where s1>a;
end
[/code]
t表的记录(1,2,3,4)
======================================================
问题:
调用方法1:CommandText = "pp(3)" 参数带到这里,既然这样,那和STRSQL直接传SQL命令进去有什么不同
调用方法2:' .Parameters(1) = 1 参数传递进去后,在最后 Set Rs_GetList = .Execute的时候就报错了。
对于VB调
相关问答:
用jsp做东西给完全不懂mysql的人用,可是备份时只有空文件,这是什么情况,
最好有源代码,谢谢
其实备份的过程我想大概是这样的:
将表A中的数据放到ArrayList中,然后将这个ArrayList中的数据再存到表B中。 ......
我在注册页面写入了如下代码:
<?php
$conn=mysql_connect("localhost","root","614510")or die("数据库服务器连接错误".mysql_error());
& ......
表结构如下:
begin_ip end_ip add1 add2
------------------- ......
假如数据库中有个test表,表中有id,Name,num,记录时间
id为自增长主键,name是名字,num表示其数量
1 nike 100 系统时间
2 nike 300 &n ......
为什么我粘贴存储过程代码的时候。。。中间出现这个了。。。
Display all 812 possibilities? (y or n)
? & ......