1:将模板字符常量存在数据库中,形成链表结构,需要时再从数据库中读取,如下图:
用数组模拟链表,然后由程序进行读取,Delphi代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var sql: string;
var str2: string;
begin
RichEdit1.Clear;
Mem1.Clear;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('Select * from 1_WZ Where id = 1');
ADOQuery1.Open;
while not ADOQuery1.IsEmpty do
begin
if ADOQuery1.FieldByName('NL').AsBoolean = true then
begin
str2:= str2 + #13;
end;
str2:= str2 + ADOQuery1.FieldByName('WText').AsString;
sql:= ADOQuery1.FieldByName('WNext').AsString;
if sql = '' then Break;
sql:= 'Select * from 1_WZ where id = ' + sql;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sql);
ADOQuery1.Open;
end;
Mem1.Lines.Add(str2);
RichEdit1.Clear;
RichEdit1.Lines.Add(str2);
end;
效果显示如下: