首 页 | 精品电影 | 音乐天堂 | 在线游戏 | Flash MTV | 三湘书屋 | 幽默笑话 | 三湘图库 | 美女写真 | IT知识库 | QQ贴图 | 加入书签

网页制作网络编程图形图象操作系统冲浪宝典软件教学网络安全认证考试通信技术电子商务业内动态书籍教程原码

最近更新 文章分类 多媒体类 精品软件

本站搜索:
您的位置:三湘时空 -> IT知识库 -> 文章分类 -> Delphi -> SaveComponentByFile
SaveComponentByFile


文章类别:Delphi 来源: 作者: 发表日期:2006-2-4 字体:[ ]

小游戏 | 在线影院 | 幽默笑话 | 源码下载 | Flash MTV | 音乐试听 | 书屋 | 美女写真

unit savecomponent1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Db, DBTables;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Query1: TQuery;
    ListBox1: TListBox;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Label1: TLabel;
    Query2: TQuery;
    Button5: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  F:TMemoryStream;
  Path:string;
  Filename:string;
begin
  Path:=ExtractFilePath(application.ExeName);
  FileName:=Path+'ListBox.ini';
  F:=TMemorystream.Create ;
  F.WriteComponent(Listbox1);
  F.SaveToFile(Filename);
  F.Free;
  listbox1.Free;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  F:TMemoryStream;
  Path:string;
  Filename:string;
  xx:Tlistbox;
begin
  xx:=Tlistbox.create(self);
  xx.parent:=self;
  Path:=ExtractFilePath(application.ExeName);
  FileName:=Path+'ListBox.ini';
  F:=TMemorystream.Create ;
  F.LoadFromFile(Filename);
  xx:=TListBox(F.ReadComponent(xx));
  F.Free;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  Path:string;
  Filename:string;
begin
  Path:=ExtractFilePath(application.ExeName);
  FileName:=Path+'ListBox.ini';
  with query1 do
    begin
      close;requestlive:=true;sql.clear;databasename:='OILREP44444';
      SQL.Add('select * from zy_query');
      open;insert;
      fieldbyname('qry_id').asinteger:=strtoint(edit1.text);
      TBlobfield(Fieldbyname('sql_blob')).loadfromfile(Filename);
      try
        post;
      except
        close;
      end;
    end;
end;

procedure TForm1.Button4Click(Sender: TObject);
var
  Path:string;
  Filename:string;
begin
  Path:=ExtractFilePath(application.ExeName);
  FileName:=Path+'ListBox.ini';
  with query1 do
    begin
      close;sql.clear;databasename:='OILREP44444';
      SQL.Add('select * from zy_query where qry_id=:qq');
      params[0].AsInteger:=strtoint(edit1.text);
      try
        open;
        TBlobfield(Fieldbyname('sql_blob')).savetofile(Filename);
      except
        close;
      end;
    end;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
listbox1.Free;
end;

上一篇:我的DBTreeView--TreeView直接连接数据表 下一篇:查找某目录下的所有文件
本栏目热门文章
·Delphi工具—反编译Delphi(三) 2006-2-4
·Delphi工具—反编译Delphi(二) 2006-2-4
·Delphi工具——反编译Delphi(一) 2006-2-4
·用FASTREPORT实现WEB应用中自定义报表 2006-2-4
·Delphi中ScriptControl的高级应用(一) 2006-2-4
·利用内存映射文件扩充程序可用的内存 2006-2-4
·QQ聊天记录器演示程序 2006-2-4
·Delphi与DirectShow&DSPack/在 2006-2-4
·UltraEdit也支持Delphi语法高亮 2006-2-4
·DirectShow之接口实战篇(二) 2006-2-4
新近更新文章
·BPCS系统现金流量分析工具开发日志 2006-2-4
·程序间相互通讯问题的解决 2006-2-4
·如何获取本地HTML文件的标题,超级链接 2006-2-4
·建立自己的csdn知识管理库(1) 2006-2-4
·使用Delphi开发多媒体播放音轨问题的FAQ(原创) 2006-2-4
·监视资源管理器的文件变化 2006-2-4
·实现在virtualStringtree中编辑的标准步骤 2006-2-4
·WINDOWS编程技巧之DELPHI篇 2006-2-4
·DELPHI面向对象支持特点--保护级类成员的应用 2006-2-4
·取Run下所有值(原创) 2006-2-4
首 页 | 软件发布 | 广告联系 | 下载帮助 | 意见反馈 | 网站地图
  CopyRight? 2002-2004 WWW.SXSKY.NET? All Rights Reserved
三湘时空 站长QQ:82675303 Email: