比如数据库里有glry这样的一个表,定义如下:
create table if not exists glry (
id int auto_increment not null ,
GONGHAO char(6) not null,
primary key (id) )
我建了如下的存储过程:
create procedure a(in b char(6))
select * from glry where GONGHAO=b
在VB中我怎么条用这个存储过程?
按照网上的资料我这样做的,建立好连接然后
Dim objCmd As ADODB.Command
Dim objPara1 As ADODB.Parameter
Set objCmd = New ADODB.Command
Set objPara1 = New ADODB.Parameter
With objCmd
.ActiveConnection = gobjConn '已建立的连接
.CommandText = "a"
.CommandType = adCmdStoredProc
End With
objPara1.Name = "@b"
objPara1.Type = adChar
objPara1.Size = 6
objPara1.Direction = adParamInput
objPara1.Value = "000001"
objCmd.Parameters.Append objPara1
Set gobjRs = objCmd.Execute
Set objCmd = Nothing
Set gobjRs = Nothing
在红字显示处出错,出错信息在word里存放,好几天了,实在是解决不了了,高手,帮帮我吧。
另外这个“@”是什么意思?
有成功的VB连接mysql的例子也好呀。
create table if not exists glry (
id int auto_increment not null ,
GONGHAO char(6) not null,
primary key (id) )
我建了如下的存储过程:
create procedure a(in b char(6))
select * from glry where GONGHAO=b
在VB中我怎么条用这个存储过程?
按照网上的资料我这样做的,建立好连接然后
Dim objCmd As ADODB.Command
Dim objPara1 As ADODB.Parameter
Set objCmd = New ADODB.Command
Set objPara1 = New ADODB.Parameter
With objCmd
.ActiveConnection = gobjConn '已建立的连接
.CommandText = "a"
.CommandType = adCmdStoredProc
End With
objPara1.Name = "@b"
objPara1.Type = adChar
objPara1.Size = 6
objPara1.Direction = adParamInput
objPara1.Value = "000001"
objCmd.Parameters.Append objPara1
Set gobjRs = objCmd.Execute
Set objCmd = Nothing
Set gobjRs = Nothing
在红字显示处出错,出错信息在word里存放,好几天了,实在是解决不了了,高手,帮帮我吧。
另外这个“@”是什么意思?
有成功的VB连接mysql的例子也好呀。
[MySQL][ODBC 3.51 Driver][mysqlld-5.0.24-community-nt]you have an error in your SQL syntax:check the manual that corresponds to your MySQL server version for the right syntax to use near'{call b('000001')}' at line 1
你所建的存储过程叫 a 这里调用的是b,不是参数 ,不是过程名字。
call a('000001') 试试。
实时错误‘-2147217900 (80040e14)’
[MySQL][ODBC 3.51 Driver][mysqlld-5.0.24-community-nt]you have an error in your SQL syntax:check the manual that corresponds to your MySQL server version for the right syntax to use near'{call a('000001')}' at line 1
& "SERVER=localhost;" _
& "Port=3306;" _
& "DATABASE=ch_base_data;" _
& "UID=ch;PWD=123456; OPTION=3;stmt=SET NAMES GB2312"