📄 daima.txt
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ADODB, DB, StdCtrls, Grids, DBGrids;
type
TForm1 = class(TForm)
Label1: TLabel;
DBGrid1: TDBGrid;
Button1: TButton;
Button2: TButton;
DataSource1: TDataSource;
ADOTable1: TADOTable;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
ADOCommand1: TADOCommand;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
sleft,sright,scontent,t1,t2,temps,temp : string;
flag,i,j,m,n,a,b,c,k : integer;
temp2:array[1..20,1..10] of string;
temp1:array[1..20] of string;
begin // begin of procedure
ADOCommand1.commandtext:='drop table tableofdopeanalysis';
ADOCommand1.Execute;
ADOCommand1.commandtext:='create table tableofdopeanalysis ([unfinality\finality] varchar(20))';
ADOCommand1.Execute; // clear all disused data
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select selectleft,selectright,content from selectagreegate ';
ADOQuery1.Open; // prepare data of ADOQuery1
b:=0; // initializing some of variable
c:=0;
j:=1;
ADOQuery1.First; // prepare the cursor
while not ADOQuery1.Eof do // ** for insert lists
begin
flag:=1;
a:=1;
temp:=''; // initializing some of variable
sright:=adoquery1.Fieldbyname('selectright').AsString; // get one field
n:=length(sright); // get length of the fiend
for m:=1 to n do
begin // make the character strings into tamporary array
temp:=copy (sright,m,1);
if comparestr(temp,',')<>0 then
begin
temps:=temps+temp; // refuse the character ","
end
else
begin
temp2[b,a]:= temps; // gether the assembled characters
temps :='';
a:=a+1;
end;
end;
b:=b+1;
ADOQuery1.Next; // get next cursor
end; // end of "while"
for i:=1 to 20 do //duo_dimensionality_list_repetition for temp2
begin
for j:=1 to 10 do //duo_dimensionality_row_repetition for temp2
begin
for k:=1 to 20 do //single_dimensionality_repetition for temp1
begin
t1:=temp1[k];
t2:=temp2[i,j];
if t1=t2 then
begin // refuse the repeated data
flag:=0;
break;
end
else
begin
flag:=1
end;
end;
if flag=1 then
begin // fill the filtrated data
ADOCommand1.commandtext:='alter table tableofdopeanalysis add '''+temp+''' varchar(20)';
ADOCommand1.Execute;
temp1[c]:=t2;
c:=c+1;
end;
end;
end; //end of "for"
ADOQuery1.first; // prepare the cursor
while not ADOQuery1.Eof do // ** insert rows
begin
sleft:=adoquery1.Fieldbyname('selectright').AsString; // get one field
for k:=1 to 20 do
begin
t1:=temp1[k];
t2:=sleft;
if t1=t2 then // refuse the repeated data
begin
flag:=0;
break;
end
else
begin
flag:=1;
end;
end;
if flag=0 then
begin // fill the filtrated data
ADOCommand1.commandtext:='insert into tableofdopeanalysis ([unfinality\finality] varchar(20)) values '''+sleft+'''';
ADOCommand1.Execute;
end;
ADOQuery1.next;
end; // end of "while"
ADOQuery1.first; // prepare the cursor
while not ADOQuery1.Eof do // ** update contest
begin
sleft:=adoquery1.Fieldbyname('selectleft').AsString; // get the fields
scontent:=adoquery1.Fieldbyname('content').AsString;
sright:=adoquery1.Fieldbyname('selectright').AsString;
ADOCommand1.CommandText:='update tableofdopeanalysis set '''+sright+''' ='''+scontent+''' where [unfinality\finality] ='''+sleft+'''';
ADOCommand1.Execute; // fill in the blanks where the row and list was both selected
ADOQuery1.Next;
end;
ADOQuery1.close;
form1.Hide;
form2.showmodal ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -