string sqltime = " select lastlogin  from usersinfo  where id = '" + userid + "'";//定义一个SQL语句,从sersinfo中读取当前用户的最后登录时间。
DateTime lstime = DateTime.Parse(DB.Readstr(sqltime, 0));//DB是自定义的一个类,Readstr是类中的一个方法,用于读取数据表中某个字段的值。并转换成时间类型。
DateTime ls = lstime.AddMinutes(60);// 将读取出的时间加上60分钟。
现在我要读取 ls 这个时间数据大于当前时间的记录。用了这样一个SQL语句:
string grxx = "select * from usersinfo  where  '" + ls + "'  >   '" + datetime.now+ "' " ;
报错:where附近有语法错误。
如果我用datediff(mm, vipstart,getdate() )  这个函数来判断,但是这个函数的第二个参数要求是字段。我的要求是在字段上加上60分钟。才与现在时间比较。所以两种方法都无法实现我的目的。请各们老师指教。学生万分感谢。