string cmdText = "select attentiontime, nickname, message from message,person where attentiontime>=" + DateTime.Now + " and attentiontime=<" + DateTime.Now.AddDays(1) + " and message.personid=person.id";语法错误:
where attentiontime>=" + DateTime.Now + " and attentiontime=<" + DateTime.Now.AddDays(1) + " and message.personid=person.id";

解决方案 »

  1.   

    改成:
    where attentiontime>='" + DateTime.Now.ToString() + "' and attentiontime<='" + DateTime.Now.AddDays(1).ToString() + "' and message.personid=person.id";
    试一试
      

  2.   

    DateTime.Now
    改成=>DateTime.Now.ToString(strFormat)
    试试看
      

  3.   

    attentiontime= <
    有这样的写法??!?!
      

  4.   


    呵呵,给你看出来了,就是>=  写成了=>,这个出错了!谢谢各位