以下为访问ACCESS数据库的语句,错误在
+' and SurveyTime>'+convert((timetostr(Vmaxdatetime),text,datetime) ;这一行,
请教高手怎么解决?ADOQueryass2.SQL.Text:='select * from '+Vdatatable+' where '
+'SurveyPointNo='+''''+VASSnodecode +''''
+' and SurveyTime>'+convert((timetostr(Vmaxdatetime),text,datetime) ;
其中SurveyTime字段为时间类型,Vmaxdatetime变量为Tdatetime类型
+' and SurveyTime>'+convert((timetostr(Vmaxdatetime),text,datetime) ;这一行,
请教高手怎么解决?ADOQueryass2.SQL.Text:='select * from '+Vdatatable+' where '
+'SurveyPointNo='+''''+VASSnodecode +''''
+' and SurveyTime>'+convert((timetostr(Vmaxdatetime),text,datetime) ;
其中SurveyTime字段为时间类型,Vmaxdatetime变量为Tdatetime类型
也不行,我想是字段类型不同的原因,所以用convert转换,请教此处应如何使用convert函数
2,'select * from '+Vdatatable+' where SurveyPointNo='''+VASSnodecode+''''
这样就可以拉
请教这样写吗?SurveyTime >#'+formatdatetime('h:mm',Vmaxtime)+'#' ;运行不能通过?
请教是为什么呀?
你试试。
+'SurveyPointNo='+''''+VASSnodecode +''''
+' and SurveyTime>'+ (timetostr(Vmaxdatetime)) ;
顺便可以把SQL语句SHOW出来看看
ADOQuery1.sql.add('....SurveyTime >:a');
ADOQuery1.Parameters[0].Value := Time;
又提示:
标准表达式中数据类型不匹配?
or
SurveyTime >'+formatdatetime('hh:mm',Vmaxtime)你再试试,如果不行话,就不太清楚了。不过access中SurveyTime即然只存 hh:mm,你又何必设为时间类型的呢,可以设为字符型(个人认为) 。