比如数据库里有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的例子也好呀。
 

解决方案 »

  1.   

    错误提示是:实时错误‘-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 b('000001')}' at line 1
      

  2.   

    在MYSQL中是否可以调用,似乎应该加上BEGIN END吧
      

  3.   

    这里显示的语法错误{call b('000001')} 
    你所建的存储过程叫 a 这里调用的是b,不是参数 ,不是过程名字。
    call a('000001') 试试。
      

  4.   

    不好意思,敲错了,就是错误提示是:
    实时错误‘-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
      

  5.   

    Hi,liuynm,伙计你的问题解决了吗怎么不见你出现呀说说答案呀 
      

  6.   

    给你一个成功连接mysql的字符串: ConnData_base = "DRIVER={MySQL ODBC 3.51 Driver};" _
                            & "SERVER=localhost;" _
                            & "Port=3306;" _
                            & "DATABASE=ch_base_data;" _
                            & "UID=ch;PWD=123456; OPTION=3;stmt=SET NAMES GB2312"
      

  7.   

    .CommandText = "call a(?)"