text1里输入的是日期,例如 2009-3-1 g = text1.text  '这个地方应该怎么写? Adodc1.CommandType = adCmdText 
Adodc1.RecordSource = "select * from wqd where wqd.取回时间 > g"  '上面的g放到这里做条件,可是总是报错 
  
Adodc1.Refresh 

解决方案 »

  1.   

    Adodc1.RecordSource = "select * from wqd where wqd.取回时间 > '" & g & "'" 
      

  2.   

    如果我单写Adodc1.CommandType = adCmdText 
    Adodc1.RecordSource = "select * from wqd where wqd.取回时间 > 2009-3-1" 这样就可以查询出来,不会报错。可是我想让用户输入时间区段,跪求大家了
      

  3.   

    回1楼:g=text2.text这地方应该怎么改呢?
      

  4.   

    g="'" & text2.text & "'"
      

  5.   

    g = "'" & Text2.Text & "'"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from wqd where wqd.取回时间 > g"这样??
    也报错:    “至少一个参数没有指定值”text2.text 里我输入的是 2009-3-1
    大伙在帮帮我
      

  6.   

    g = "'" & Text2.Text & "'" 
    Adodc1.CommandType = adCmdText 
    'Access库,精确到秒
    Adodc1.RecordSource = "select * from wqd where datediff('s','"& g &"',wqd.取回时间)>0"
    'SQL Server库,精确到秒
    Adodc1.RecordSource = "select * from wqd where datediff(second,'"& g &"',wqd.取回时间)>0"
      

  7.   

    什么数据库啊? ACCESS用这个
    g = "#" & Text2.Text & "#"