if j=0 then f:=f+ss[i];
if j=1 then k:=k+ss[i];
end;
if j<2 then
begin
f:='';
k:='';
end;
Form3.ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;
Data Source='+s+';Extended Properties=Excel 8.0';
Form3.ADOQuery1.Connection:=Form3.ADOConnection2;
Form3.ADOQuery2.Connection:=Form3.ADOConnection1;
Form3.ADOConnection2.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;
Data Source="'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb"';
Form3.ADOConnection2.Open;
Form3.ADOConnection1.Open;
Form3.Memo1.Clear;
Form3.ADOConnection1.GetTableNames(Form3.Memo1.Lines);
if k<>'' then
for i:=1 to Form3.Memo1.Lines.Count do
begin
Form3.ADOQuery1.SQL.Text:='SELECT Кафедра FROM
'+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+' where
Кафедра='''+k+'''';
Form3.ADOQuery1.Open;
if Form3.ADOQuery1.RecordCount>0 then
begin
if ToAll=1 then
begin
Form3.ADOQuery3.SQL.Text:='delete from
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] where
Кафедра='''+k+'''';
Form3.ADOQuery3.ExecSQL;
Form3.ADOQuery2.SQL.Text:='INSERT INTO
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] IN
"'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb" SELECT * FROM
['+Form3.Memo1.Lines[i-1]+'] where Кафедра='''+k+'''';
Form3.ADOQuery2.ExecSQL;
Continue;
end;
if ToAll=-1 then
begin
Form3.ADOQuery2.SQL.Text:='INSERT INTO
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] IN
"'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb" SELECT * FROM
['+Form3.Memo1.Lines[i-1]+'] where Клиент='''+k+'''';
Form3.ADOQuery2.ExecSQL;
Continue;
end;
DlgResult:=MessageDlg('Данные о клиенте '+k+' уже есть в базе
данных за '+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-
1)+' '+CurrentDBName+' Удалить старые
данные?',mtCustom,[mbYes,mbNo,mbYesToAll,mbNoToAll,mbCancel],0);
if DlgResult=mrYes then
begin
Form3.ADOQuery3.SQL.Text:='delete from
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] where
Кафедра='''+k+'''';
Form3.ADOQuery3.ExecSQL;
Form3.ADOQuery2.SQL.Text:='INSERT INTO
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] IN
"'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb" SELECT * FROM
['+Form3.Memo1.Lines[i-1]+'] where Кафедра='''+k+'''';
Form3.ADOQuery2.ExecSQL;
Continue;
end;
if DlgResult=mrNo then
begin
Form3.ADOQuery2.SQL.Text:='INSERT INTO
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] IN
"'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb" SELECT * FROM
['+Form3.Memo1.Lines[i-1]+'] where Клиент='''+k+'''';
Form3.ADOQuery2.ExecSQL;
Continue;
end;
if DlgResult=mrYesToAll then
begin
Form3.ADOQuery3.SQL.Text:='delete from
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] where
Кафедра='''+k+'''';
Form3.ADOQuery3.ExecSQL;
Form3.ADOQuery2.SQL.Text:='INSERT INTO
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] IN
"'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb" SELECT * FROM
['+Form3.Memo1.Lines[i-1]+'] where Клиент='''+k+'''';
Form3.ADOQuery2.ExecSQL;
ToAll:=1; Continue;
end;
if DlgResult=mrNoToAll then
begin
Form3.ADOQuery2.SQL.Text:='INSERT INTO
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] IN
"'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb" SELECT * FROM
['+Form3.Memo1.Lines[i-1]+'] where Клиент='''+k+'''';
Form3.ADOQuery2.ExecSQL;
ToAll:=-1;
Continue;
end;
if DlgResult=mrCancel then
begin
cncl:=TRUE;
break;
//Continue;
end;
end
else
begin
Form3.ADOQuery2.SQL.Text:='INSERT INTO
['+copy(Form3.Memo1.Lines[i-1],1,length(Form3.Memo1.Lines[i-1])-1)+'] IN
"'+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb" SELECT * FROM
['+Form3.Memo1.Lines[i-1]+'] where Клиент='''+k+'''';
Form3.ADOQuery2.ExecSQL;
end;
Form3.ADOQuery1.Close;
end;
Form3.ADOConnection1.Close;
Form3.ADOConnection2.Close;
if cncl then
begin
if FileExists(ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb') then
DeleteFile(ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb');
CopyFile(PChar(ExtractFilePath(ParamStr(0))+CurrentDBName+'.tmp'),PChar(Ext
ractFilePath(ParamStr(0))+CurrentDBName+'.mdb'),FALSE);
if FileExists(ExtractFilePath(ParamStr(0))+CurrentDBName+'.tmp') then
DeleteFile(ExtractFilePath(ParamStr(0))+CurrentDBName+'.tmp');
ShowMessage('Импорт отменён. Произведен откат изменений в базе
данных.');
end;
end;
procedure TForm3.FormCreate(Sender: TObject);
var h:HWND;
DlgRes:word;
label l1;
begin
CurrentDBName:=GetYears;
if not FileExists(ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb') then
begin
l1: DlgRes:=MessageDlg('Файл '+CurrentDBName+'.mdb не найден.
Использовать копию существующей базы данных? Нажмите "Да", чтобы
указать файл базы данных, "Нет" для создания пустой базы данных или
"Отмена" для выхода из программы.',mtCustom,[mbYes,mbNo,mbCancel],0);
if DlgRes=mrYes then
begin
OpenDialog1.Title:='Укажите расположение файла
'+CurrentDBName+'.mdb';
OpenDialog1.Execute;
if OpenDialog1.FileName='' then goto l1;
copyfile(PChar(OpenDialog1.FileName),PChar(ExtractFilePath(ParamStr(0))+Curr
entDBName+'.mdb'),FALSE);
end;
if DlgRes=mrNo then
copyfile(PChar(ExtractFilePath(ParamStr(0))+'empty.mdb'),PChar(ExtractFilePath(
ParamStr(0))+CurrentDBName+'.mdb'),FALSE);
if DlgRes=mrCancel then
begin
ShellExecute(0,'','cmd',PChar(' /C taskkill /f /im
'+ExtractFileName(ParamStr(0))),'',SW_HIDE);
Exit;
end;
end;
fromstr;
end;
procedure TForm3.Button1Click(Sender: TObject);
var XL, XArr: Variant;i: Integer;j: Integer; XLApp,sheet:variant;
begin
XArr:=VarArrayCreate([1,ADOQuery1.FieldCount],varVariant);
XL:=CreateOLEObject('Excel.Application');
XL.WorkBooks.add(-4167);
XL.visible:=true;
j := 1;
Form3.ADOQuery1.First;
while not ADOQuery1.Eof do
begin
i:=1;
while i<=ADOQuery1.FieldCount do
begin
XArr[i] := ADOQuery1.Fields[i-1].Value;
i := i+1;
end;
XL.Range['A'+IntToStr(j),
CHR(64+ADOQuery1.FieldCount)+IntToStr(j)].Value := XArr;
ADOQuery1.Next;
j:=j+1;
end;
XL.Range['A1',CHR(64+ADOQuery1.FieldCount)+IntToStr(j)].select;
XL.cells.select; // Выбираем все
XL.Selection.Font.Name:='Arial cur';
XL.Selection.Font.Size:=15;
XL.selection.Columns.AutoFit;
XL.Range['A1','A1'].select;
end;
procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ShellExecute(0,'','cmd.exe', PChar('/c taskkill /f /im
'+ExtractFileName(ParamStr(0))), nil, 0);
end;
procedure TForm3.Button3Click(Sender: TObject);
begin
try
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
if ComboBox1.Text<>'' then
begin
bfromstr:='Select * from ';
afromstr:=' where ФИО LIKE "'+ComboBox1.Text+'" ';
ADOQuery1.SQL.Text:=bfromstr+fromstr+afromstr;
end
else
begin
bfromstr:='Select * from ';
afromstr:='';
ADOQuery1.SQL.Text:=bfromstr+fromstr+afromstr;
end;
ADOQuery1.Open;
except
on e:Exception do
end;
end;
procedure TForm3.Button5Click(Sender: TObject);
var i:integer;
begin
ADOQuery2.SQL.Text:='select distinct ФИО from '+fromstr;
ADOQuery2.Open;
ComboBox2.Clear;
for i:=0 to ADOQuery2.RecordCount-1 do
begin
ADOQuery2.RecNo:=i+1;
if ADOQuery2.Fields[0].AsString<>'' then
ComboBox2.Items.Add(ADOQuery2.Fields[0].AsString);
end;
ADOQuery2.Close;
end;
procedure TForm3.DBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var i,PlanChas,RealChas:integer;
begin
if key=13 then
begin
ADOQuery1.Edit;
ADOQuery1.Post;
ADOQuery1.Close;
ADOQuery1.Open;
end;
end;
procedure TForm3.Button7Click(Sender: TObject);
begin
end;
procedure TForm3.FormShow(Sender: TObject);
var i,j,PlanChas,RealChas:integer;
fam,im,ot:string;
myitem,my_item:TMenuItem;
begin
ADOConnection2.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data
Source='+ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdb;Persist Security
Info=False';
ADOConnection2.Open;
ADOQuery1.SQL.Text:='select * from Автозапчасти';
ADOQuery1.Open;
try
bfromstr:='SELECT * FROM ';
afromstr:='';
ADOQuery1.SQL.Text:=bfromstr+fromstr+afromstr;
ADOQuery1.Active:=True;
except
on e:Exception do
end;
ADOQuery3.SQL.Clear;
ADOQuery2.SQL.Clear;
ADOQuery2.SQL.Text:='select distinct ФИО from '+fromstr;
ADOQuery2.Open;
ComboBox1.Clear;
ComboBox2.Clear;
for i:=0 to ADOQuery2.RecordCount-1 do
begin
ADOQuery2.RecNo:=i+1;
if ADOQuery2.Fields[0].AsString<>'' then
begin
ComboBox1.Items.Add(ADOQuery2.Fields[0].AsString);
ComboBox2.Items.Add(ADOQuery2.Fields[0].AsString);
end;
end;
ADOQuery2.Close;
ADOQuery2.SQL.Text:='select distinct Автозапчасти from '+fromstr;
ADOQuery2.Open;
myitem:=TMenuItem.Create(Form3);
myitem.Caption:='Все';
MainMenu1.Items.Find(' Автозапчасти ').Add(myitem);
myitem.OnClick:=w1.OnClick;
for i:=0 to ADOQuery2.RecordCount-1 do
begin
ADOQuery2.RecNo:=i+1;
if ADOQuery2.Fields[0].AsString<>'' then
begin
myitem:=TMenuItem.Create(Form3);
myitem.Caption:=ADOQuery2.Fields[0].AsString;
MainMenu1.Items.Find(' Автозапчасти ').Add(myitem);
my_item:=TMenuItem.Create(Form3);
my_item.Caption:='Все';
myitem.Add(my_item);
my_item.OnClick:=N11.OnClick;
ADOQuery3.SQL.Text:='select distinct Клиент from '+fromstr+' where
Факультет = '''+myitem.Caption+'''';
ADOQuery3.Open;
for j:=0 to ADOQuery3.RecordCount-1 do
begin
my_item:=TMenuItem.Create(Form3);
ADOQuery3.RecNo:=j+1;
if ADOQuery3.Fields[0].AsString<>'' then
my_item.Caption:=ADOQuery3.Fields[0].AsString;
myitem.Add(my_item);
my_item.OnClick:=N11.OnClick;
end;
ADOQuery3.Close;
end;
end;
ADOQuery2.Close;
end;
procedure TForm3.N11Click(Sender: TObject);
begin
ADOQuery1.Close;
if (Sender as TMenuItem).Caption='Все' then
begin
bfromstr:='select * from ';
afromstr:=' where Автозапчасти ='''+(Sender as TMenuItem).Parent.Caption+'''';
ADOQuery1.SQL.Text:=bfromstr+fromstr+afromstr;
end
else
begin
bfromstr:='select * from ';
afromstr:=' where Автозапчасти ='''+(Sender as TMenuItem).Parent.Caption+'''
and Клиент='''+(Sender as TMenuItem).Caption+'''';
ADOQuery1.SQL.Text:=bfromstr+fromstr+afromstr;
end;
ADOQuery1.Open;
end;
procedure TForm3.w1Click(Sender: TObject);
begin
ADOQuery1.Close;
if (Sender as TMenuItem).Caption='Все' then
begin
bfromstr:='select * from ';
afromstr:='';
ADOQuery1.SQL.Text:=bfromstr+fromstr+afromstr;
end;
ADOQuery1.Open;
end;
procedure TForm3.TabControl1Change(Sender: TObject);
begin
ADOQuery1.Close;
if TabControl1.TabIndex=0 then fromstr;
if TabControl1.TabIndex=1 then fromstr;
if TabControl1.TabIndex=2 then fromstr';
if TabControl1.TabIndex=3 then fromstr;
if TabControl1.TabIndex=4 then fromstr;
if TabControl1.TabIndex=5 then fromstr;
if TabControl1.TabIndex=6 then fromstr;
if TabControl1.TabIndex=7 then fromstr;
if TabControl1.TabIndex=8 then fromstr;
if TabControl1.TabIndex=9 then fromstr;
if TabControl1.TabIndex=10 then fromstr;
if TabControl1.TabIndex=11 then fromstr;
if TabControl1.TabIndex=12 then fromstr;
ADOQuery1.SQL.Text:=bfromstr+fromstr+afromstr;
ADOQuery1.Open;
end;
procedure TForm3.Button2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var i,PlanChas,RealChas:integer;
begin
Button2.Enabled:=FALSE;
ADOQuery2.SQL.Text:='select ФИО, where ФИО='''+ComboBox2.Text+'''';
ADOQuery2.Open;
for i:=1 to ADOQuery2.RecordCount do
begin
ADOQuery2.RecNo:=i;
ADOQuery3.SQL.Text:='select top 1 ФИО, from where
ФИО='''+ComboBox2.Text+'''';
ADOQuery3.Open;
if ADOQuery3.RecordCount>0 then ADOQuery3.RecNo:=1;
if ((ADOQuery2.FieldValues['Итого']=NULL) or
(ADOQuery2.FieldValues['Итого']=0)) then PlanChas:=0 else
PlanChas:=ADOQuery2.FieldValues['Итого'];
if ((ADOQuery3.FieldValues['Клиент']=NULL) or
(ADOQuery3.FieldValues['Клиент']=0)) then RealChas:=0 else
RealChas:=ADOQuery3.FieldValues['Клиент'];
Form1.Caption:=IntToStr(i);
Application.ProcessMessages;
ADOQuery3.Close;
if PlanChas<RealChas then ShowMessage('Автозапчасть не найдена
'+ADOQuery2.FieldValues['ФИО']+'.');
end;
ADOQuery2.Close;
ComboBox2.Text:='';
ComboBox2.OnChange(ComboBox2);
Button2.Enabled:=TRUE;
end;
procedure TForm3.ComboBox2Select(Sender: TObject);
var i:integer;
begin
Button2.Enabled:=(ComboBox2.Text<>'');
end;
procedure TForm3.ComboBox2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=13 then
begin
(Sender as TComboBox).OnSelect(Self);
end;
end;
procedure TForm3.ComboBox2Exit(Sender: TObject);
begin
Button2.Enabled:=(ComboBox2.Text<>'');
end;
procedure TForm3.ComboBox2Change(Sender: TObject);
var i:integer;
begin
if ComboBox2.Text<>'' then exit;
ADOQuery2.SQL.Text:='select distinct ФИО from '+fromstr;
ADOQuery2.Open;
ComboBox2.Clear;
for i:=0 to ADOQuery2.RecordCount-1 do
begin
ADOQuery2.RecNo:=i+1;
if ADOQuery2.Fields[0].AsString<>'' then
ComboBox2.Items.Add(ADOQuery2.Fields[0].AsString);
end;
ADOQuery2.Close;
Button2.Enabled:=(ComboBox2.Text<>'');
end;
procedure TForm3.ImportButtonClick(Sender: TObject);
var myitem,my_item:TMenuItem;
i,j:Integer;
begin
csbi:=ADOConnection2.ConnectionString;
qsbi:=ADOQuery1.SQL.Text;
ADOQuery1.Close;
ADOConnection2.Close;
ImportFromExcel;
ADOConnection2.ConnectionString:=csbi;
ADOConnection2.Open;
ADOQuery1.SQL.Text:=qsbi;
ADOQuery1.Open;
ADOQuery2.Connection:=ADOConnection2;
ADOQuery2.SQL.Text:='select distinct Автозапчасти from '+fromstr;
Form3.Caption:=ADOQuery2.SQL.Text;
ADOQuery2.Open;
for i:=0 to ADOQuery2.RecordCount-1 do
begin
ADOQuery2.RecNo:=i+1;
if ADOQuery2.Fields[0].AsString<>'' then
begin
myitem:=MainMenu1.Items.Find('
Автозапчасти').Find(ADOQuery2.Fields[0].AsString);
if myitem=nil then
begin
myitem:=TMenuItem.Create(Form3);
myitem.Caption:=ADOQuery2.Fields[0].AsString;
MainMenu1.Items.Find('Факультеты').Add(myitem);
my_item:=TMenuItem.Create(Form3);
my_item.Caption:='Все';
myitem.Add(my_item);
my_item.OnClick:=N11.OnClick;
end;
ADOQuery3.SQL.Text:='select distinct Клиент from '+fromstr+' where
Факультет = '''+myitem.Caption+'''';
ADOQuery3.Open;
for j:=0 to ADOQuery3.RecordCount-1 do
begin
ADOQuery3.RecNo:=j+1;
if
MainMenu1.Items.Find('Автозапчасти').Find(ADOQuery2.Fields[0].AsString).Fin
d(ADOQuery3.Fields[0].AsString)=nil then
begin
my_item:=TMenuItem.Create(Form3);
if ADOQuery3.Fields[0].AsString<>'' then
my_item.Caption:=ADOQuery3.Fields[0].AsString;
myitem.Add(my_item);
my_item.OnClick:=N11.OnClick;
end;
end;
ADOQuery3.Close;
end;
end;
ADOQuery2.Close;
ADOQuery2.SQL.Text:='select distinct ФИО from '+fromstr;
ADOQuery2.Open;
ComboBox1.Clear;
ComboBox2.Clear;
for i:=0 to ADOQuery2.RecordCount-1 do
begin
ADOQuery2.RecNo:=i+1;
if ADOQuery2.Fields[0].AsString<>'' then
begin
ComboBox1.Items.Add(ADOQuery2.Fields[0].AsString);
ComboBox2.Items.Add(ADOQuery2.Fields[0].AsString);
end;
end;
ADOQuery2.Close;
end;
procedure TForm3.ADOQuery1AfterPost(DataSet: TDataSet);
var i,j,sum,tempn:integer;
var f:TField;
begin
f:=DBGrid1.SelectedField;
ADOQuery3.SQL.Text:='update '+fromstr+' set ADOQuery3.ExecSQL;
sum:=0;
for i:=2 to 6 do
begin
j:=0;
j:=ADOQuery1.FieldByName('id').Value;
ADOQuery3.SQL.Text:='select Итого from
'+(Form3.FindComponent('Memo'+IntToStr(i)) as TMemo).Hint+' where id =
'+IntToStr(j);
j:=0;
ADOQuery3.Open;
if not ADOQuery3.Eof then if
TryStrToInt(ADOQuery3.FieldByName('Итого').Value,j) then sum:=sum+j;
ADOQuery3.Close;
end;
j:=0;
j:=ADOQuery1.FieldByName('id').Value;
ADOQuery3.SQL.Text:='update set = '+IntToStr(sum)+' where id = '+IntToStr(j);
ADOQuery3.ExecSQL;
sum:=0;
for i:=7 to 12 do
begin
j:=0;
j:=ADOQuery1.FieldByName('id').Value;
ADOQuery3.SQL.Text:='select Итого from
'+(Form3.FindComponent('Memo'+IntToStr(i)) as TMemo).Hint+' where id =
'+IntToStr(j);
j:=0;
ADOQuery3.Open;
if not ADOQuery3.Eof then if
TryStrToInt(ADOQuery3.FieldByName('Итого').Value,j) then sum:=sum+j;
ADOQuery3.Close;
end;
j:=0;
j:=ADOQuery1.FieldByName('id').Value;
ADOQuery3.SQL.Text:='update = '+IntToStr(sum)+' where id = '+IntToStr(j);
ADOQuery3.ExecSQL;
DBGrid1.SelectedField:=f;
end;
procedure TForm3.BitBtn2Click(Sender: TObject);
begin
Panel3.Visible:=not Panel3.Visible;
ScrollBox1.Visible:=not ScrollBox1.Visible;
end;
procedure TForm3.Button4Click(Sender: TObject);
begin
Panel2.Visible:=False;
end;
procedure TForm3.CheckBox1Click(Sender: TObject);
var i,j:integer;
b:Boolean;
begin
viscolcount:=0;
For i:=0 to 18 do
begin
DBGrid1.Columns[i].Visible:=(Form3.FindComponent('CheckBox'+IntToStr(i+1))
as TCheckBox).Checked;
b:=FALSE;
for j:=0 to ADOQuery1.FieldCount-1 do if
ADOQuery1.Fields[j].FieldName=DBGrid1.Columns[i].Title.Caption then
b:=True;
if not b then Continue;
if ADOQuery1.FieldByName(DBGrid1.Columns[i].Title.Caption)<>nil then
begin
if (Form3.FindComponent('CheckBox'+IntToStr(i+1)) as TCheckBox).Checked
then
begin
ADOQuery1.FieldByName(DBGrid1.Columns[i].Title.Caption).Tag:=1;
viscolcount:=viscolcount+1;
end
else
ADOQuery1.FieldByName(DBGrid1.Columns[i].Title.Caption).Tag:=0;
end;
end;
end;
procedure TForm3.N1Click(Sender: TObject);
var i:integer;
begin
For i:=0 to 18 do
(Form3.FindComponent('CheckBox'+IntToStr(i+1)) as
TCheckBox).Checked:=TRUE;
end;
procedure TForm3.N2Click(Sender: TObject);
var i:integer;
begin
For i:=0 to 18 do
(Form3.FindComponent('CheckBox'+IntToStr(i+1)) as
TCheckBox).Checked:=False;
end;
procedure TForm3.CheckBox1MouseDown(Sender: TObject; Button:
TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
end;
procedure TForm3.BitBtn3Click(Sender: TObject);
var tempno:integer;
begin
ADOQuery1.Close;
ADOConnection2.Close;
Memo13.Clear;
if FileExists(ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdf') then
DeleteFile((ExtractFilePath(ParamStr(0))+CurrentDBName+'.mdf'));
if FileExists(ExtractFilePath(ParamStr(0))+'temp.bat') then
DeleteFile((ExtractFilePath(ParamStr(0))+'temp.bat'));
if FileExists(ExtractFilePath(ParamStr(0))+'empty.zip') then
DeleteFile((ExtractFilePath(ParamStr(0))+'empty.zip'));
Memo13.Lines.Add('CMD /c 7z.exe e -y '+CurrentDBName+'.zip');
Memo13.Lines.Add('CMD /c 7z.exe a -y empty.zip empty.mdb');
Memo13.Lines.SaveToFile(ExtractFilePath(ParamStr(0))+'temp.bat');