Home > Back-end >  TXT text content (field name and number can configure file configuration) into the database
TXT text content (field name and number can configure file configuration) into the database

Time:10-22

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Var
Found, DoFirst strindex, I, j, n, m, a: integer;
F: tsearchrec;
StrListCur1 StrListAll1, StrListCur2 StrListAll2, StrListCur3, StrListAll3, StrListCur4, StrListAll4: Tstringlist;
MyList, MyList1 MyList2, MyList3: TStringList;
Dir, filepath filepath1, STR, str1, str2, str3, str6, st, sfzh1, sfzh2, gmsfzhm1, gmsfzhm2, z_code, z_code1, sary_xh, sary_xh1, JSSJ, jssj1, HTSJ, XSJ, DWSJ, bh, cyh, bm, GMSFHM1, GMSFHM2, CZFWBH2, ssfj2, sspcs2, sssq2, dxtel, DXFSF, ccfwdz2, BJPCS, xcbk_xh, CRIMINAL_ID, bjxx_xh, BJBH, bjxh1, cyjlbh, cyjlxh1, cyjlxh, ZZDZ: string;
Ss2: TSearchRec;
STRS, strs1: tstrings;


The begin
The begin
I:=0;
Mylist:=TStringlist. Create;
Mylist. LoadFromFile (ExtractFilePath (Application. ExeName) + 'js \ ceshi. TXT ");
J:=mylist. Count;
While iThe begin
STR:=mylist. Strings [I];

The STRS: tstringlist=. Create;
STRS. Delimiter:='|';
STRS. DelimitedText:=STR;
The begin
JYBH:=STRS [0];
CSRXZ:=STRS [1].
CSDWDZ:=STRS [2];
JGDW:=STRS [3].
SGRBH:=STRS [4];
//RKSJ:=STRS [5].
end;
//the above can operation by the field name in the configuration file is read
//such as (JYBH, CSRXZ CSDWDZ, JGDW, SGRBH) field dynamic configuration
//which fields can be added or deleted
Inc (I);
With adoquery11 do
The begin
The close;
SQL. The Clear;
SQL. The Add (' select count (*) as maxts from TZHY_JYJLZB where JYBH=' '+ JYBH + "' ");
The open;

end;
If adoquery11. FieldByName (' maxts) AsInteger> 0 then
The begin

With ADOQuery1 do
The begin
The close;
SQL. The Clear;
SQL. The Add (' update TZHY_JYJLZB set JYBH='" + JYBH +' ' ', CSRXZ='" + CSRXZ +' ' ', CSDWDZ='" + CSDWDZ +' ' ', JGDW=' '+ JGDW +' ' ', ');
SQL. The Add (' SGRBH="' + SGRBH + ' ' 'where JYBH=' '+ JYBH +"' ");
Execsql;
end;

End
The else
The begin

With ADOQuery1 do
The begin
The close;
SQL. The Clear;
SQL. Add (' insert into TZHY_JYJLZB (JYBH, CSRXZ, CSDWDZ, ');
SQL. The Add (' JGDW SGRBH));
SQL. Add (' values (' '+ JYBH +' ' ', ' '+ CSRXZ +' ' ', ' '+ CSDWDZ +' ' ', ' '+ JGDW +' ' ', ');
SQL. The Add (" '+ SGRBH +' ' ') ');
Execsql;
end;

end;

end;
end;
Mylist1:=TStringList. Create;
MyList1. The Clear;
MyList1. SaveToFile (' + ExtractFilePath (Application. ExeName) + 'js \ ceshi. TXT ");
end;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

CodePudding user response:

No one answered

CodePudding user response:

The
refer to the original poster yandan_198 response:
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Var
Found, DoFirst strindex, I, j, n, m, a: integer;
F: tsearchrec;
StrListCur1 StrListAll1, StrListCur2 StrListAll2, StrListCur3 StrListAll3, StrList...

//the above can operation by the field name in the configuration file is read
//such as (JYBH, CSRXZ CSDWDZ, JGDW, SGRBH) field dynamic configuration
//which fields can be added or deleted
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Can be realized by the configuration file:
Define a 2 d array or contains two fields of struct array (can use generic unit after delphi2007 TDictionary).
Fill the content when you read the file.

You can also put together a requirements issued, everyone together help to deal with
  • Related