垃圾是不是可以封装呀???我记得看过ad方面的查询它吧查询条件定义成了一个类,可惜看不懂???郁闷(10分)

  • 主题发起人 hnzcg124
  • 开始时间
H

hnzcg124

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure Tsb_jlqjzjgl_cx.BitBtn1Click(Sender: TObject);
var k:string;
begin
if (combobox1.Text='') then
begin
application.MessageBox('请输入查询条件','提示!',mb_ok);
exit;
end;
if (combobox9.Text<>'')and((combobox3.Text='')or (combobox4.text=''))then
begin
application.MessageBox('不符合多条查询的条件','提示!',mb_ok);
exit;
end;//---------------
if (combobox10.Text<>'')and((combobox5.Text='')or (combobox6.text=''))then
begin
application.MessageBox('不符合多条查询的条件','提示!',mb_ok);
exit;
end;//----------
if (combobox11.Text<>'')and ((combobox7.Text='')or (combobox8.Text=''))then
begin
application.MessageBox('不符合多条查询的条件','提示!',mb_ok);
exit;
end;//-------------
//----------------------------------------
if (combobox1.Text<>'') and
((trim(edit1.Text)='') and (dbdatetimeediteh1.Text=' - - '))then
begin
application.MessageBox('查询条件不完全,请输入查询条件','提示!',mb_ok);
exit;
end;//---------------------------------------------------------------------
if (combobox3.Text<>'') and
((trim(edit2.Text)='') and (dbdatetimeediteh2.Text=' - - '))then
begin
application.MessageBox('查询条件不完全,请输入查询条件','提示!',mb_ok);
exit;
end;//---------------------------------------------------------------------
if (combobox5.Text<>'') and
((trim(edit3.Text)='') and (dbdatetimeediteh3.Text=' - - '))then
begin
application.MessageBox('查询条件不完全,请输入查询条件','提示!',mb_ok);
exit;
end;
if (combobox7.Text<>'') and
((trim(edit4.Text)='') and (dbdatetimeediteh4.Text=' - - '))then
begin
application.MessageBox('查询条件不完全,请输入查询条件','提示!',mb_ok);
exit;
end;
//-----------------------------------------------------------------------------
str1:=' '
k:=' ';
if combobox2.Text='模糊查询' then
begin
str1:=i1+' '+' like '+' '+''''+trim(edit1.Text)+'%'+'''';
end
else
begin
str1:=i1+' '+trim(combobox2.Text)+' '+''''+trim(edit1.Text)+'''';
end;
if (combobox3.text='购进日期')or(combobox3.Text='检定时间')then
begin
str1:=i1+' '+trim(combobox2.Text)+' '+''''+trim(dbdatetimeediteh1.Text)+'''';
end;
case combobox9.ItemIndex of
0: str1:=str1+' and ';
1: str1:=STR1+' or ';
end;//-----------------------
k:=str1+' '+str3+' '+str5+' '+str7;
sb_jlqjzjgl.ClientDataSet1.close
//好像只能查一遍
sb_jlqjzjgl.ClientDataSet1.CommandText:='select * from sb_jljd where '+k;
sb_jlqjzjgl.ClientDataSet1.Open;
if sb_jlqjzjgl.ClientDataSet1.RecordCount=0 then
begin
if application.MessageBox('没有找到符合条件的记录'+#13#10+'是否重新搜索?','询问?',mb_okcancel+mb_iconquestion)=idok then
begin
combobox1.Text:='';combobox3.Text:='';combobox5.Text:='';combobox7.Text:='';
combobox3.Enabled:=false;combobox5.Enabled:=false;combobox7.Enabled:=false;
//-----------------------------------------------------------------------------
combobox2.Enabled:=false;combobox4.Enabled:=false;combobox6.Enabled:=false;combobox8.Enabled:=false;
combobox2.Clear;combobox4.Clear;combobox6.Clear;combobox8.Clear;
//--------------------------------------------------------------------------
edit1.Text:='';edit2.Text:='';edit3.Text:='';edit4.Text:='';
edit1.Visible:=true;edit2.Visible:=true;edit3.Visible:=true;edit4.Visible:=true;
edit1.Enabled:=false;edit2.Enabled:=false;edit3.Enabled:=false;edit4.Enabled:=false;
//-----------------------------------------------------------------------------
dbdatetimeediteh1.Visible:=false;dbdatetimeediteh2.Visible:=false;
dbdatetimeediteh3.Visible:=false;dbdatetimeediteh4.Visible:=false;
dbdatetimeediteh1.Text:=' - - ';dbdatetimeediteh2.Text:=' - - ';
dbdatetimeediteh3.Text:=' - - ';dbdatetimeediteh4.Text:=' - - ';
//------------------------------------------------------------------------------
combobox9.Enabled:=false;combobox10.Enabled:=false;combobox11.Enabled:=false;
combobox9.Clear;combobox10.Clear;combobox11.Clear;
//---------------------------------------------------------------------------
str1:='';str3:='';str5:='';str7:='';
i1:='';i3:='';i5:='';i7:='';
combobox1.Enabled:=true;
exit;
end
else close;
end else
begin
sb_jlqjzjgl.StatusBar1.Panels[0].Text:='符合条件的记录有:'+inttostr(sb_jlqjzjgl.ClientDataSet1.RecordCount)+'条';
close;
end;
end;
 
顶部