st:=datetostr(datetimepicker1.date)+' '+FormatDateTime('hh:nn:ss',DateTimePicker2.DateTime);
et:=datetostr(datetimepicker3.date)+' '+FormatDateTime('hh:nn:ss',DateTimePicker4.DateTime);
sqlstr :='select w.csno as SN,w.macno as macAddress,s.model,s.cdt AS Date,c.wcname as TestStation, '
+' (case s.ispass when 0 then '+Quotedstr('FAIL')+' else '+Quotedstr('PASS')+' end) as [TestResult], '
+' (case s.ispass when 0 then f.defect else '+Quotedstr('')+' end) as [FailCode], '
+' (case s.ispass when 0 then d.doc else '+Quotedstr('')+' end) as [FailureReason],'+Quotedstr('')+' as DefectType,'+Quotedstr('')+' as RefDes,'+Quotedstr('Sercomm')+' as [ODM] '
+' from sfc_log s with(nolock) '
+' full join wosn09 w with(nolock) '
+' on w.pcb + w.isno = s.isno '
+' full join wc c with(nolock) '
+' on s.wcno = c.wcno '
+' full join sfc_dftm d with(nolock) '
+' on s.isno = d.isno '
+' full join defect f with(nolock) '
+' on d.defect = f.defect '
+' where s.cdt>='+Quotedstr('st') +'and s.cdt <='+Quotedstr('et')+ 'and w.macno <>'+Quotedstr(''); with ADOQuery1 do
begin
ADOQuery1.close;
ADOQuery1.sql.Clear;
ADOQuery1.sql.Add(sqlstr);
ADOQuery1.open;
label4.Caption:='共找到'+inttostr(adoquery1.RecordCount)+'条记录。';
end;
执行的时候总是提示“从字元字串转换到datetime时,转换失败”
请问WHERE后面的条件该如何修改?
et:=datetostr(datetimepicker3.date)+' '+FormatDateTime('hh:nn:ss',DateTimePicker4.DateTime);
sqlstr :='select w.csno as SN,w.macno as macAddress,s.model,s.cdt AS Date,c.wcname as TestStation, '
+' (case s.ispass when 0 then '+Quotedstr('FAIL')+' else '+Quotedstr('PASS')+' end) as [TestResult], '
+' (case s.ispass when 0 then f.defect else '+Quotedstr('')+' end) as [FailCode], '
+' (case s.ispass when 0 then d.doc else '+Quotedstr('')+' end) as [FailureReason],'+Quotedstr('')+' as DefectType,'+Quotedstr('')+' as RefDes,'+Quotedstr('Sercomm')+' as [ODM] '
+' from sfc_log s with(nolock) '
+' full join wosn09 w with(nolock) '
+' on w.pcb + w.isno = s.isno '
+' full join wc c with(nolock) '
+' on s.wcno = c.wcno '
+' full join sfc_dftm d with(nolock) '
+' on s.isno = d.isno '
+' full join defect f with(nolock) '
+' on d.defect = f.defect '
+' where s.cdt>='+Quotedstr('st') +'and s.cdt <='+Quotedstr('et')+ 'and w.macno <>'+Quotedstr(''); with ADOQuery1 do
begin
ADOQuery1.close;
ADOQuery1.sql.Clear;
ADOQuery1.sql.Add(sqlstr);
ADOQuery1.open;
label4.Caption:='共找到'+inttostr(adoquery1.RecordCount)+'条记录。';
end;
执行的时候总是提示“从字元字串转换到datetime时,转换失败”
请问WHERE后面的条件该如何修改?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货