M
masterli
Unregistered / Unconfirmed
GUEST, unregistred user!
var
Form1: TForm1;
Treelist : Tstringlist;
///////////////////// 将流保存起来
procedure TForm1.ConstructSymptom;
var
TempQuery : Tadoquery;
Trees : TMemorystream;
begin
try
Treelist := Tstringlist.Create;
TempQuery := Tadoquery.Create(nil);
TempQuery.ConnectionString := 'Provider=SQLOLEDB.1;Password="";Persist Security Info=True;User ID=sa;Initial Catalog=Data2;Data Source=zff';
with TempQuery do
begin
close;
sql.Clear;
sql.Add('select Tblname,tree from TblTree');
open;
end;
while not TempQuery.Eof do
begin
Trees := TMemorystream.Create;
tblobfield(TempQuery.Fields[1]).SaveToStream(Trees);
Treelist.AddObject(TempQuery.Fields[0].AsString,Tobject(@Trees));
TempQuery.Next;
end;
finally
TempQuery.Free;
end;
end;
///////////////////////////// 没办法把流读出来
procedure TForm1.N5Click(Sender: TObject);
var
i : integer;
P : Pointer;
tree : TMemorystream;
begin
for i := 0 to Treelist.Count -1 do
if Treelist.Strings = 'sym' then
begin
P := pointer(Treelist.Objects);
tree := TMemorystream(p^);
tree.Position := 0;
// TMemorystream().Position:=0;
// Treeview2.LoadFromStream(TMemorystream(Treelist.Objects));
showmessage('Find now!');
end;
end;
Form1: TForm1;
Treelist : Tstringlist;
///////////////////// 将流保存起来
procedure TForm1.ConstructSymptom;
var
TempQuery : Tadoquery;
Trees : TMemorystream;
begin
try
Treelist := Tstringlist.Create;
TempQuery := Tadoquery.Create(nil);
TempQuery.ConnectionString := 'Provider=SQLOLEDB.1;Password="";Persist Security Info=True;User ID=sa;Initial Catalog=Data2;Data Source=zff';
with TempQuery do
begin
close;
sql.Clear;
sql.Add('select Tblname,tree from TblTree');
open;
end;
while not TempQuery.Eof do
begin
Trees := TMemorystream.Create;
tblobfield(TempQuery.Fields[1]).SaveToStream(Trees);
Treelist.AddObject(TempQuery.Fields[0].AsString,Tobject(@Trees));
TempQuery.Next;
end;
finally
TempQuery.Free;
end;
end;
///////////////////////////// 没办法把流读出来
procedure TForm1.N5Click(Sender: TObject);
var
i : integer;
P : Pointer;
tree : TMemorystream;
begin
for i := 0 to Treelist.Count -1 do
if Treelist.Strings = 'sym' then
begin
P := pointer(Treelist.Objects);
tree := TMemorystream(p^);
tree.Position := 0;
// TMemorystream().Position:=0;
// Treeview2.LoadFromStream(TMemorystream(Treelist.Objects));
showmessage('Find now!');
end;
end;