<%@ Page Language="vb"%>语言是vb
dim sql1 as string= "Select * From 客户 where 联系人='"& gmr1.text & "' and  日期="format(Datetime.now,"yyyy-MM-dd")"
日期在access数据库中类型是短日期  格式如2010-4-6

解决方案 »

  1.   

    Dim sql1 As String = "Select * From 客户 where 联系人='" & gmr1.text & "' and 日期=" & Format(DateTime.Now, "yyyy-MM-dd")
      

  2.   

    Dim sql1 As String = "Select * From 客户 where 联系人='" & gmr1.text & "' and 日期='" & Format(DateTime.Now, "yyyy-MM-dd") & "'"
      

  3.   

    sql语句构造错了,参照2楼的就可以了了
      

  4.   

    Access 数据库的日期型要用#符号Dim sql1 As String = "Select * From 客户 where 联系人='" & gmr1.text & "' and 日期=#" & Format(DateTime.Now, "yyyy-MM-dd") & "#"
      

  5.   

    ACCESS两边加上#表示日期,改成这样:
    Dim sql1 As String = "Select * From 客户 where 联系人='" & gmr1.text & "' and 日期 = #" & Format(DateTime.Now, "yyyy-MM-dd") & "#"