关于查询时,跳出一个表里一个时间字段没有默认值!!!(20分)

只你

Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下:
procedure TFrmSaleSch.ToolButton1Click(Sender: TObject);
var
__sql,__sqlw,__c:string;
begin
__sql:='select * from SHSheetid where 1=1 ';
if Edit5.Text <>'' then begin
__sqlw:=' and sheetid='+''''+edit5.Text+'''';
end;
if edit2.Text<>'' then begin
__sqlw:=__sqlw+' and productid='''+edit2.Text+'''';
end;
if edit4.Text<>'' then begin
__sqlw:=__sqlw+' and Pname like '+'''%'+edit4.Text+'%''';
end;
if CheckBox1.Checked then begin
__sqlw:=__sqlw+' and Pdate >= #'+formatdatetime('yyyy-mm-dd',DateTimePicker1.datetime)+'#'
+' and Pdate <= #'+formatdatetime('yyyy-mm-dd',DateTimePicker2.datetime)+'#';
end;
//就是执行到这边的时候哦跳出pdate参数没有默认值

if __sqlw='' then begin
showmessage('请输入查找条件!');
exit;
end;
 
检查一下引号是否对应
 
引号有对应
 
虽然没人回答,但是我自己解决了,结贴了
 
接受答案了.
 
顶部