sql="select Name,JB,Tdate from newwork where Tdate='" & Mydate & "'"

解决方案 »

  1.   

    select Name,JB,Tdate from newwork where Tdate=#2003-1-15#
      

  2.   

    CMD.ActiveConnection = CN
    CMD.CommandType = adCmdText
    CMD.CommandText = "select Name,JB,Tdate from newwork where Tdate=?"CMD.Parameters.Append  CMD.CreateParameter(, adVarChar, _ adParamInput, 100, RecordInfo(1))
    set rs =CMD.Execute
      

  3.   

    不行呀,用右键点击Command1选择属性,有个SQL语句输入框,我不是用第一种方式,但是不行。说类型不匹配。
      

  4.   

    1.在数据环境中的SQL语句输入
      select Name,JB,Tdate from newwork where Tdate=?
    2.确定后制定参数的数据类型为日期型
    3.代码中使用
      if DEV.rsCommand.State=1 then DEV.rsCommand.Close
      DEV.Command Cdate(MyDate)
      这样就打开你要的记录集了
      

  5.   

    还是不行。
    我是这样写的:
    SELECT name,jb,tdate FROM Dowork WHERE (takemoney = True) AND (takedate >= '"& ydate & "')是不是有错。用Adodc控件都没有问题,在数据环境中就不行。
    ydate 是在模块中定义的全局变量。
      

  6.   

    "SELECT name,jb,tdate FROM Dowork WHERE (takemoney = True) AND (takedate >= " & ydate & ")"