(1).在vb 怎样调用存储过程?
   (2).我想用sql语句把当天生日的客户找出来,其中客户资料表中,“客户生日”字段是”日期\时间“类型。

解决方案 »

  1.   

    (1)Dim com As ADODB.Command
    Set com = New ADODB.Command
    com.ActiveConnection = CN'cn为连接字符串
    com.ActiveConnection.CommandTimeout = 30
    com.ActiveConnection.CursorLocation = adUseServercom.CommandText = "daycount"'存储过程名
    com.CommandType = adCmdStoredProc
    com.Parameters("@mydate") = "2004-10-7"'参数名,没有参苏可以不写
    Dim re As ADODB.Recordset
    Set re = com.Execute
    (2)select 客人名 from 客人表 where datediff('day',getdate(),客人生日)=0
      

  2.   

    1 使用ADO对象库,你可以看看MSDN:
    我写一个最简单的例子:
    dim objCnn as adodb.connection
    dim objCmd as adodb.command
    objcnn.open ...'连接数据库
    objcmd.activeconnect=objcnn
    objcmd.commandtype=adCmdStoredProc
    objcmd.commandtext="op_test" '调用名为op_test的储存过程,这个过程没有参数。
    objcmd.execute
    ...2 sql语句:
    select * from 客户资料表 where datediff(d,客户生日,getdate())=0
      

  3.   

    select * from 客户资料表 where datediff('d',客户生日,getdate())=0