L
langyanqi
Unregistered / Unconfirmed
GUEST, unregistred user!
unit PublcRSFN;interfaceuses IdHashMessageDigest, IdGloabal,IdHash;type Md5Get = class; {实例区} Md5Get = class //获取MD5值 private md5:TIdHashMessageDigest5; dst:T4x4LongWordRecord; mymd5:string; inputval:string; public function Md5Get(dst:???):string; begin md5:=TIdHashMessageDigest5.create; dst:=md5.HashValue(inputval); mymd5:=md5.AsHex(dst); end;end.--------------------------我是线-------------------------------------------unit insertmd5AdminFN;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,IdHashMessageDigest,IdGlobal,IdHash;type Tinsertmd5Admin = class(TForm) Label1: TLabel; Button1: TButton; Button2: TButton; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;var insertmd5Admin: Tinsertmd5Admin;implementationuses datamodule,PublcRSFN;{$R *.dfm}procedure Tinsertmd5Admin.Button1Click(Sender: TObject);var enymd5:strin inputval:stringbegin inputval:=pd.text; PublcRSFN.Md5Get(inputval); enymd5:=PublcRSFN.md5get(gst); with dm.adoquery do begin close; sql.Clear; sql.Add('insert into userinfo(realname,username,userpass)values(''测试账号'',''root'','+QuotedStr(enymd5)+')'); //showmessage(sql.Text); //dm.adoquery.ExecSQL; end;end;--------------------------我是线-------------------------------------------这样才是真正的代码分离,可以吗,能帮我完善代码吗,或者谁写个VCL来实现呢??????????不胜感激