




已閱讀5頁,還剩63頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DB, ADODB, jpeg, ExtCtrls;type TForm1 = class(TForm) ADOConnection1: TADOConnection; ADOQuery1: TADOQuery; Edit1: TEdit; Edit2: TEdit; Button1: TButton; Button2: TButton; ADOTable1: TADOTable; Image1: TImage; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Button3: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private Private declarations public count:integer; Public declarations end;var Form1: TForm1;implementationuses Unit12,Unit19;$R *.dfmprocedure TForm1.Button1Click(Sender: TObject); var yonghu:string;begin yonghu:=trim(edit1.Text);/trim去除字符串空格 count:=count+1;/登陸次數(shù) with adoquery1 do begin Close; SQL.Clear; SQL.text:=select * from 用戶信息表 where 用戶名=+yonghu+; open; if (adoQuery1.RecordCount0) and (edit2.Text) and (adoQuery1.FieldByName(密碼).AsString= edit2.Text) then begin if adoQuery1.FieldByName(是否管理員).AsString =True then begin form12.SpeedButton1.Visible:=true; form12.Button13.Visible:=true; application.MessageBox(密碼正確,即將進入系統(tǒng)。,提示,mb_ok); form1.Hide; form12.Show; end else begin form12.SpeedButton1.Visible:=false; form12.Button13.Visible:=false; application.MessageBox(密碼正確,即將進入系統(tǒng)。,提示,mb_ok); form1.Hide; form12.Show; end; end else begin if (count=1) then begin application.MessageBox(用戶名或密碼錯誤,還剩2次機會,提示,mb_ok); edit1.SetFocus;/光標是向左對齊的 也就是在編輯框的最左邊 end; if(count=2) then begin application.MessageBox(您還有最后一次機會,請仔細核對用戶名和密碼,提示,mb_ok); edit1.Clear; edit2.clear; edit1.SetFocus; end; if (count=3) then begin application.MessageBox(密碼錯誤超過三次系統(tǒng)即將關(guān)閉,提示,mb_ok); application.Terminate;/退出程序 end; end; end;end;procedure TForm1.Button2Click(Sender: TObject);begin application.Terminate;end;procedure TForm1.Button3Click(Sender: TObject);begin form19.ShowModal;end;End.unit Unit2;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids, DBGrids, jpeg, ExtCtrls, DB, ADODB;type TForm2 = class(TForm) Image1: TImage; Label1: TLabel; GroupBox1: TGroupBox; DBGrid1: TDBGrid; Button1: TButton; GroupBox2: TGroupBox; GroupBox3: TGroupBox; GroupBox4: TGroupBox; Label3: TLabel; Label4: TLabel; Edit1: TEdit; Edit2: TEdit; Label5: TLabel; RadioButton1: TRadioButton; RadioButton2: TRadioButton; Button2: TButton; Label6: TLabel; Label7: TLabel; Edit3: TEdit; RadioButton3: TRadioButton; RadioButton4: TRadioButton; Button3: TButton; ADOConnection1: TADOConnection; ADOTable1: TADOTable; ADOQuery1: TADOQuery; ADOQuery2: TADOQuery; DataSource1: TDataSource; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormShow(Sender: TObject); private Private declarations public Public declarations end;var Form2: TForm2;implementation$R *.dfmprocedure TForm2.Button1Click(Sender: TObject);begin if application.MessageBox(請確認是否要刪除, 超市倉庫管理系統(tǒng), mb_iconinformation +mb_yesno) = idyes then/MB_ICONINFORMATION是顯示出的對話框里會有一個“i”圖標,mb_yesno同時顯示確定和取消按鈕,idyes單擊”是“按鈕 ADOtable1.Delete;end;procedure TForm2.Button2Click(Sender: TObject);var yonghuming,mima:string; quanxian:boolean;begin if (edit1.Text) and (edit2.Text) and (radiobutton1.Checked xor radiobutton2.Checked) then begin yonghuming:=edit1.Text; adoquery1.Close; adoquery1.SQL.Text := select * from 用戶信息表 where 用戶名= +yonghuming+ ; adoquery1.open; if not adoquery1.Eof then/判斷表是否為空 begin MessageBox(handle, 此用戶名已存在!, 提示, mb_IconInformation + mb_Ok); exit; end; mima:=edit2.Text; if radiobutton1.Checked=true then quanxian:=true else quanxian:=false; adotable1.InsertRecord(yonghuming,mima,quanxian); adotable1.Close; /把ADOTable控件對應的數(shù)據(jù)源關(guān)閉 adotable1.Open;/重新打開ADOTable控件對應的數(shù)據(jù)源,這樣做的目的是刷新數(shù)據(jù)源 showmessage(新建用戶添加成功); edit1.Clear; edit2.Clear; radiobutton1.Checked:=false; radiobutton2.Checked:=false; end else showmessage(信息填寫不全);end;procedure TForm2.Button3Click(Sender: TObject);var yonghuming:string; quanxian:boolean;begin if (edit3.Text) and (radiobutton3.Checked xor radiobutton4.Checked) then begin yonghuming:=edit3.Text; adoquery1.Close; adoquery1.SQL.Text := select * from 用戶信息表 where 用戶名= +yonghuming+ ; adoquery1.open; if adoquery1.RecordCount = 0 then begin showmessage(不存在此用戶,請重新輸入); edit3.SetFocus; exit; end; if radiobutton3.Checked=true then quanxian:=true else quanxian:=false; if application.MessageBox(請確認是否要修改, 超市倉庫管理系統(tǒng), mb_iconinformation + mb_yesno) = idyes then begin adotable1.Locate(用戶名,yonghuming,); adotable1.Edit; adotable1是否管理員:=quanxian; adotable1.Post; adotable1.Close; adotable1.Open;/更改一個已經(jīng)從數(shù)據(jù)庫中讀取的數(shù)據(jù)庫表格 showmessage(修改成功); end; end else showmessage(信息填寫不全);end; procedure TForm2.FormShow(Sender: TObject);beginadoconnection1:=TADOConnection.Create(nil);/動態(tài)創(chuàng)建ADO控件adoconnection1.LoginPrompt:=false;/如果不加這句的話,每次連接數(shù)據(jù)庫時都會跳出一個身份驗證對話框,要求你輸入用戶名和密碼adoconnection1.Connected:=false;/釋放連接adoconnection1.ConnectionString:=Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=天天;Data Source=WIN-RNSK1TMAK9L;adoconnection1.Connected:=true;adotable1:=TADOTable.Create(nil);adotable1.Connection:=adoconnection1;adotable1.TableName:=用戶信息表;adotable1.Open;datasource1.DataSet:=adotable1;adoquery1:=TADOQuery.Create(nil);adoquery1.Connection:=adoconnection1;adoquery2:=TADOQuery.Create(nil);adoquery2.Connection:=adoconnection1;end;end.unit Unit3;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ADODB, DB, StdCtrls, Grids, DBGrids, jpeg, ExtCtrls;type TForm3 = class(TForm) GroupBox1: TGroupBox; GroupBox2: TGroupBox; GroupBox3: TGroupBox; Image1: TImage; Label1: TLabel; DBGrid1: TDBGrid; Button1: TButton; Button2: TButton; Button3: TButton; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; Edit7: TEdit; ComboBox1: TComboBox; ComboBox2: TComboBox; Label11: TLabel; ComboBox3: TComboBox; Edit8: TEdit; Button4: TButton; Button5: TButton; Button6: TButton; ADOConnection1: TADOConnection; ADOTable1: TADOTable; DataSource1: TDataSource; ADOQuery1: TADOQuery; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure FormShow(Sender: TObject); private Private declarations public Public declarations end;var Form3: TForm3;implementation$R *.dfm procedure TForm3.FormShow(Sender: TObject);begin adoconnection1:=TADOConnection.Create(nil);adoconnection1.LoginPrompt:=false;adoconnection1.Connected:=false;adoconnection1.ConnectionString:=Provider=SQLOLEDB.1;Password=411114;Persist Security Info=True;User ID=sa;Initial Catalog=天天;Data Source=win-rnsk1tmak9l;adoconnection1.Connected:=true;adotable1:=TADOTable.Create(nil);adotable1.Connection:=adoconnection1;adotable1.TableName:=商品信息表;adotable1.Open;datasource1.DataSet:=adotable1;adoquery1:=TADOQuery.Create(nil);adoquery1.Connection:=adoconnection1;adoquery1.Close;adoquery1.SQL.Clear;adoquery1.SQL.Text:=select 倉庫名稱 from 倉庫信息表;adoquery1.Open; while not adoquery1.Eof do begin combobox2.Items.Add(adoquery1倉庫名稱); adoquery1.Next; end;end;procedure TForm3.Button2Click(Sender: TObject);begin adotable1.Edit;end;procedure TForm3.Button1Click(Sender: TObject);begin if application.MessageBox(確定要刪除?, 超市倉庫管理系統(tǒng), mb_iconinformation + mb_yesno) = idyes thenbegin adotable1.Delete; showmessage(刪除成功); end;end;procedure TForm3.Button3Click(Sender: TObject);begin adotable1.Post; showmessage(修改成功);end;procedure TForm3.Button4Click(Sender: TObject); vartemp:string; juti:string;begin juti:=edit8.Text; if(combobox3.Text)and(edit8.Text) then begin if (combobox3.ItemIndex=0) then/ItemIndex=0列表標號從0開始 begin adotable1.Filtered:=false; adotable1.Filter:=商品編號=+juti+; adotable1.Filtered:=true; end; if (combobox3.ItemIndex=1) then begin adotable1.Filtered:=false;/ 解除過濾 temp:=trim(%+juti+%); adotable1.Filter:=商品名稱 like +temp+; adotable1.Filtered:=true; end; if (combobox3.ItemIndex=2) then begin adotable1.Filtered:=false; adotable1.Filter:=型號=+juti+; adotable1.Filtered:=true; end; if (combobox3.ItemIndex=3) then begin adotable1.Filtered:=false; adotable1.Filter:=倉庫名稱=+juti+; adotable1.Filtered:=true; end; end;end;procedure TForm3.Button5Click(Sender: TObject);begin adotable1.Filtered:=false;adotable1.Close;adotable1.Open;end;procedure TForm3.Button6Click(Sender: TObject);begin if (edit1.Text) and (edit2.Text) and (edit3.Text) and (edit4.Text) and (edit5.Text) and (edit6.Text) and (edit7.Text) and (combobox1.Text) and (combobox2.Text) then begin if application.MessageBox(確定要添加?, 超市倉庫管理系統(tǒng), mb_iconinformation + mb_yesno) = idyes then begin adotable1.InsertRecord(edit1.Text,edit2.Text,edit3.Text,combobox1.Text,edit4.Text,edit5.Text,combobox2.Text,edit6.Text,edit7.Text); adotable1.Close; adotable1.Open; showmessage(新商品添加成功); end; end else showmessage(信息未填全);end;end.unit Unit4;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ADODB, DB, StdCtrls, Grids, DBGrids, jpeg, ExtCtrls;type TForm4 = class(TForm) Image1: TImage; Label1: TLabel; GroupBox1: TGroupBox; GroupBox2: TGroupBox; DBGrid1: TDBGrid; DBGrid2: TDBGrid; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; DataSource1: TDataSource; DataSource2: TDataSource; ADOConnection1: TADOConnection; ADOTable1: TADOTable; ADOQuery1: TADOQuery; ADOQuery2: TADOQuery; ADOQuery3: TADOQuery; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Edit3KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure DBGrid1CellClick(Column: TColumn); procedure FormShow(Sender: TObject); private Private declarations public Public declarations end;var Form4: TForm4;implementation$R *.dfmprocedure TForm4.Button1Click(Sender: TObject);begin if application.MessageBox(請確認是否要刪除, 超市倉庫管理系統(tǒng), mb_iconinformation + mb_yesno) = idyes then begin adotable1.Delete; end;end;procedure TForm4.Button2Click(Sender: TObject);begin adotable1.Edit;end;procedure TForm4.Button3Click(Sender: TObject);begin adotable1.Post;showmessage(修改成功);end;procedure TForm4.Button4Click(Sender: TObject);var cangku,dizhi,bianhao:string;begin if (edit1.Text) and (edit2.Text) and (edit3.Text) then begin cangku:=edit1.Text; dizhi:=edit2.Text; bianhao:=edit3.Text; adoquery1.Close; adoquery1.SQL.Text := select * from 倉庫信息表 where 倉庫名稱= +cangku+ ; adoquery1.open; if not adoquery1.Eof then begin MessageBox(handle, 此倉庫名已存在!, 提示, mb_IconInformation + mb_Ok); exit; end; adoquery1.Close; adoquery1.SQL.Text := select * from 員工信息表 where 編號= +bianhao+ ; adoquery1.open; if adoquery1.RecordCount = 0 then begin showmessage(不存在此用戶,請重新輸入); edit3.SetFocus; exit; end; if application.MessageBox(確定要添加新倉庫?, 超市倉庫管理系統(tǒng), mb_iconinformation + mb_yesno) = idyes then begin adotable1.InsertRecord(cangku,dizhi,bianhao); adotable1.Close; adotable1.Open; showmessage(新倉庫添加成功); end; end else showmessage(信息未填全);end;procedure TForm4.Edit3KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); var bianhao:string;begin bianhao:=edit3.Text; with adoquery2 dobegin close; sql.clear; sql.add(select 姓名 from 員工信息表 where 編號=+bianhao+); open; edit4.Text:=Fieldbyname(姓名).AsString; close; sql.clear; sql.add(select 電話 from 員工信息表 where 編號=+bianhao+); open; edit5.Text:=Fieldbyname(電話).AsString;end;end;procedure TForm4.DBGrid1CellClick(Column: TColumn);vartemp:variant;workerId:string;begintemp:=DataSource1.DataSet.FieldValues負責人編號;workerID:=VarToStr(temp);adoquery3.Close;adoquery3.SQL.Clear;adoquery3.SQL.Text:=select 編號,姓名,性別,電話,地址,出生日期,部門,職務 from 員工信息表 where 編號=+workerid+;adoquery3.Open; dbgrid2.Columns0.Width:=100; dbgrid2.Columns1.Width:=100; dbgrid2.Columns2.Width:=100; dbgrid2.Columns3.Width:=100; dbgrid2.Columns4.Width:=100; dbgrid2.Columns5.Width:=100; dbgrid2.Columns6.Width:=100; dbgrid2.Columns7.Width:=100;end; procedure TForm4.FormShow(Sender: TObject);beginadoconnection1:=TADOConnection.Create(nil);adoconnection1.LoginPrompt:=false;adoconnection1.Connected:=false;adoconnection1.ConnectionString:=Provider=SQLOLEDB.1;Password=411114;Persist Security Info=True;User ID=sa;Initial Catalog=天天;Data Source=win-rnsk1tmak9l;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WIN-RNSK1TMAK9L;adoconnection1.Connected:=true;adotable1:=TADOTable.Create(nil);adotable1.Connection:=adoconnection1;adotable1.TableName:=倉庫信息表;adotable1.Open;datasource1.DataSet:=adotable1;adoquery1:=TADOQuery.Create(nil);adoquery1.Connection:=adoconnection1;adoquery2:=TADOQuery.Create(nil);adoquery2.Connection:=adoconnection1;adoquery3.Connection:=adoconnection1;end;end.unit Unit5;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids, DBGrids, ComCtrls, DBCtrls, DB, ADODB,JPEG, ExtCtrls;type TForm5 = class(TForm) GroupBox1: TGroupBox; Label1: TLabel; DBGrid1: TDBGrid; Button1: TButton; GroupBox2: TGroupBox; Label2: TLabel; Edit1: TEdit; Label3: TLabel; RadioButton1: TRadioButton; RadioButton2: TRadioButton; Label4: TLabel; Edit2: TEdit; Label5: TLabel; Edit3: TEdit; Label6: TLabel; DateTimePicker1: TDateTimePicker; Label7: TLabel; ComboBox1: TComboBox; Label8: TLabel; Edit4: TEdit; Label9: TLabel; GroupBox3: TGroupBox; Label10: TLabel; ComboBox2: TComboBox; Edit5: TEdit; Button2: TButton; Button3: TButton; ADOConnection1: TADOConnection; ADOTable1: TADOTable; DataSource1: TDataSource; OpenDialog1: TOpenDialog; Button5: TButton; Button6: TButton; Edit6: TEdit; Image1: TImage; Image2: TImage; Label11: TLabel; Button4: TButton; Button7: TButton; procedure Button5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure DBGrid1CellClick(Column: TColumn); procedure Button4Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private Private declarations public Public declarations end;var Form5: TForm5;implementation var myjpeg,myjpeg1:TJpegImage; tempstream,tempstream1:TMemoryStream;$R *.dfmprocedure TForm5.Button5Click(Sender: TObject);var bianhao,yuangong,dianhua,dizhi,bumen,zhiwu,chusheng:string; xingbie:string; max:integer;begin if (edit1.Text) and (edit2.Text)and (edit3.Text) and (edit4.Text) and (radiobutton1.Checked xor radiobutton2.Checked) and(combobox1.Text) then begin yuangong:=edit1.Text; bianhao:=edit6.Text; dianhua:=edit2.Text; dizhi:=edit3.Text; bumen:=combobox1.Text; zhiwu:=edit4.Text; chusheng:= datetostr(datetimepicker1.date); if radiobutton1.Checked=true then xingbie:=男 else xingbie:=女; adotable1.InsertRecord(bianhao,yuangong,xingbie,dianhua,NULL,dizhi,chusheng,bumen,zh
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年中國蝦產(chǎn)品數(shù)據(jù)監(jiān)測報告
- 自愿頂名協(xié)議書范本
- 藥品入市協(xié)議書模板
- 融資平臺租賃合同協(xié)議
- 茶樓供貨協(xié)議書模板
- 花店合作入股合同協(xié)議
- 裝修廢材料清運合同協(xié)議
- 衣服架子擺攤轉(zhuǎn)讓合同協(xié)議
- 蘋果地解除合同協(xié)議
- 自由插畫師合同協(xié)議
- 專利代理師筆試考試題庫帶答案
- 2025-2030中國重型商用車空氣彈簧行業(yè)市場現(xiàn)狀分析及競爭格局與投資發(fā)展研究報告
- 2025年統(tǒng)計學期末考試題庫:綜合案例分析題模擬試卷
- 祈使句(含答案解析)七年級英語下冊單元語法精講精練(人教版)
- 2025-2030中國微控制器(MCU)市場競爭格局與投資建設深度解析研究報告
- 《中英飲食文化差異》課件
- 2024年韶關(guān)市始興縣事業(yè)單位招聘工作人員筆試真題
- 《課件:散熱模組概述與設計原理》
- 2025-2030中國風電齒輪箱行業(yè)投資策略與可持續(xù)發(fā)展建議研究報告
- 華為招聘面試題及答案
- 盡職調(diào)查專項法律服務合同
評論
0/150
提交評論