一、windows應用程式的呼叫
1.在uses中宣告 shellapi
2.在implementation的前面用var 定義例如: diropen: string='c:\生僻字資料庫\幫助.doc'
3. 呼叫函式為: shellexecute(0,'open',pansichar(diropen),0,0,sw_show );
eg:diropeneudcedit: string='c:\windows\system32\eudcedit.exe';
shellexecute(0,'open',pansichar(diropeneudcedit),0,0,sw_show );
4.extractfilepath(paramstr(0)) 可以隨著資料夾的不同而開啟
egshellexecute(0,'open',pansichar(''+extractfilepath(paramstr(0))+'新編windows api參考大全.doc'),0,0,sw_show );
二、資料庫操作
edit類的引用
(where後都要引號,insert時數字不用引號,其他包括日期都要用引號
''''+edit1.text+''''引用過來的是已經帶引號的字串
edit.txt直接引用過來的是數字,
1例如插入數字
sql1:=edit1.text
adoquery1.sql.add('insert table_name values('+sql1+ ') ')
2.插入日期或者字元
sql1:= ''''+edit1.text+''''
adoquery1.sql.add('insert table_name values('+sql1+ ') ')
3.where 後面的條件
sql1:= ''''+edit1.text+''''
sqlstr:= 'select * from table_name where x='sql1
adoquery1.sql.add (sqlstr)
資料庫插**:
procedure tform1.button1click(sender: tobject);
begin
if openpicturedialog1.execute then
image1.picture.loadfromfile(openpicturedialog1.filename);
end;
procedure tform1.button2click(sender: tobject);
var jpegimage:tjpegimage;//記得前面要引用jpeg
begin
jpegimage:=tjpegimage.create建立jpeg影象物件
tryjpegimage.loadfromfile(openpicturedialog1.filename); //從檔案中裝載jpg影象,
adoquery1.edit;
dbimage1.picture.bitmap.assign(jpegimage); //將jpg匯入
adoquery1.post;
finally
jpegimage.free; //釋放物件
end;
end;
資料的插入
procedure tnew.button1click(sender: tobject);
var id,position,dname,price:string;
begin
if(edit1.text='')or(edit2.text='')or(edit3.text='')or
(edit4.text='')
then showmessage('請填寫完整')
else begin
id:=edit1.text;
position:=edit2.text;
dname:=''''+edit3.text+'''';
price:=edit4.text;
tryadoquery1.sql.clear;
adoquery1.sql.add('insert into 碟 values('+id+','+position+','+dname+','+price+')');
adoquery1.execsql;
showmessage('成功錄入');
adoquery1.close;
edit1.text:='';edit2.text:='';edit3.text:='';
edit4.text:='';
except
showmessage('輸入的文字或數字格式不對')
end;
end;
end;
資料的刪除
procedure txinxiguanli.button1click(sender: tobject);
var id,position,dname,price,shanchu:string;
begin
id:=dbedit1.text;
adoquery1.sql.clear;
shanchu:='delete from 碟 where 碟編號='+id+'';
adoquery1.sql.add(shanchu);
adoquery1.execsql;
showmessage('成功刪除');
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from 碟');
adoquery1.open;
資料的更新
procedure txinxiguanli.button2click(sender: tobject);
var id,position,dname,price,sql1:string;
begin
if(dbedit1.text='')or(dbedit2.text='')or(dbedit3.text='')or
(dbedit4.text='')
then showmessage('請填寫完整')
else begin
id:=dbedit1.text;
position:=dbedit2.text;
dname:=''''+dbedit3.text+'''';
price:=dbedit4.text;
adoquery1.sql.clear;
sql1:=' update 碟 set 碟編號='+id+' , 碟位號='+position+', 碟名='+dname+', 單價='+price+' where 碟編號='+id+' ';
adoquery1.sql.add(sql1);
adoquery1.execsql;
showmessage('已經儲存修改的資訊!') ;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from 碟');
adoquery1.open;
三、資料庫的手動動連線
access
procedure texchange.button1click(sender: tobject);
var cstr : string; //連線資料庫字串
begin
cstr := 'provider=microsoft.jet.oledb.4.0;'+
data source='+opendialog.filename+';'+
persist security info=false';
if then
:= false;
:= cstr;
try:= true;
except
showmessage('請檢查所選資料來源是否正確,連線失敗!');
exit;
end;
showmessage('成功連線——!'+opendialog.filename);
end;
excel
procedure texchange.button1click(sender: tobject);
var cstr : string; //連線資料庫字串
begin
cstr := 'provider=microsoft.jet.oledb.4.0;'+
data source='+opendg.filename+';'+
extended properties=excel 8.0;'+
persist security info=false';
if then
:= false;
:= cstr;
try:= true;
except
showmessage('請檢查所選資料來源是否正確,連線失敗!');
exit;
end;
showmessage('成功連線——!'+opendialog.filename);
end;
四、新窗體的初始化
application.createform(t窗體名, 窗體名);
eg:窗體的顯示和關閉
application.createform(tdatamod,datamod);
exchangeform.showmodal;
DELPHI1012銷售管理系統的設計與實現
銷售管理系統的設計與實現 隨著資訊時代的到來,全球資訊化進入了乙個新的發展時期。人們越來越認識到計算機強大的資訊模組處理功能,使之成為資訊產業的基礎和支柱。首先論述了開發銷售管理系統的意義,其次運用 軟體工程 中的方法對銷售管理系統進行了可行性研究以及需求分析,並詳細介紹了銷售管理系統開發的基本方法...
Delphi實驗室裝置管理系統設計報告
西安石油大學經濟管理學院 資訊管理與資訊系統專業 經管 1002班 組號 第八組 組員 蔡慶豐吳泓言 前言 2 一 系統設計背景 2 二 小組分工 2 第1章總體設計 3 1.1 開發環境的選擇 3 1.1.1 delphi 7 3 1.1.2 microsoft office access 200...
計算機畢業設計29Delphi超市銷售管理系統設計
第一章總論 1.1 delphi 6.0簡介 delphi6.0是著名的borland 現在已和inprise合併 公司開發的視覺化軟體開發工具。真正的程式設計師用c,聰明的程式設計師用delphi 這句話是對delphi最經典 最實在的描述。delphi被稱為 程式語言,它具有簡單 高效 功能強大...
版式設計總結
所謂的版式設計就是在有限的空間裡,編排,安排,組織管理 圖形 文字色彩及工藝,材料等設計要求,同樣的要素通過不同的編排會產生不同的效果。編排組織,管理設計師版式設計的重點。在上這門課前我從來沒想到版式也可以這麼多樣化,也可以這麼的自由化,第一次感覺這個專業的廣泛性。在現代社會,編排設計早成為了世界不...
設計模式總結
軟體設計中散發的臭氣 1 僵化性 rigidity 很難對軟體進行改動,因為每個改動都會迫使許多對系統其他部分的改動。2 脆弱性 fragility 對系統的改動會導致系統中和改動的地方在概念上無關的許多地方出現問題。3 牢固性 immobility 很難解開系統中某部分與其他部分的糾結,從而難以使...