unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, jpeg, ExtCtrls,comobj;
type
TForm1 = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label7: TLabel;
Label8: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
i_user: TEdit;
i_passwd: TEdit;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
user,name,dept,popedom:string;
end;
var
Form1: TForm1;
Conn1, Rec1 : variant;
implementation
uses Unit2, Unit5;
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Conn1 :=CreateOleObject('ADODB.Connection');
//Conn1.Open('Driver={Microsoft Access Driver (*.mdb)};DBQ=e:/房产管理/system.dat');
Conn1.Open('Driver={SQL Server};server=erp-server;uid=admin1;pwd=admin1;database=企业信息资源');
//driver={SQL Server};server=服务器;uid=用户名;pwd=口令;database=数据库名
{建立一个数据集对象,并从数据表中提取数据}
Rec1 :=CreateOleObject('ADODB.RecordSet');
Rec1.open( 'select * from 用户 where 用户名='''+i_user.text+'''',Conn1,3,3,0001);
if not rec1.eof then
begin
if rec1.fields['密码'].value=i_passwd.Text then
begin
if rec1.fields['职责'].value='车间' then
begin
[red] user:=rec1.fields['用户名'].value;
name:=rec1.fields['姓名'].value;
dept:='asdfasdfasadf';[/black][/red] dept:=rec1.fields['部门'].value ;
popedom:=rec1.fields['职责'].value ;[/b][/b]
form1.Free ;
formB.show;
end ;
end
else
begin
Messagedlg('密码有误,请重新输入', mtInformation,[mbok],0);
end;
end
else
begin
Messagedlg('该用户名不存在,请重新输入', mtInformation,[mbok],0);
end ;
end;
end.
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls, DB, DBTables, DBCtrls,comobj,unit1;
type
TFormB11 = class(TForm)
GroupBox2: TGroupBox;
Label6: TLabel;
Label9: TLabel;
Label10: TLabel;
Edit2: TEdit;
Edit4: TEdit;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button8: TButton;
Label5: TLabel;
Edit1: TEdit;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit3: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Label2: TLabel;
ComboBox1: TComboBox;
Label11: TLabel;
ComboBox2: TComboBox;
Label12: TLabel;
Label13: TLabel;
Button1: TButton;
Button2: TButton;
Button7: TButton;
Label14: TLabel;
Edit11: TEdit;
Label15: TLabel;
Edit12: TEdit;
StringGrid1: TStringGrid;
Label16: TLabel;
procedure Button8Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormB11: TFormB11;
Conn1, Rec1 : variant;
t,i:integer;
implementation
uses Unit2, Unit6;
{$R *.dfm}
procedure TFormB11.FormCreate(Sender: TObject);
begin
edit1.Text :=formatdatetime('yyyymm',date);
combobox2.Clear ;
Conn1 :=CreateOleObject('ADODB.Connection');
Conn1.Open('Driver={SQL Server};server=erp-server;uid=admin1;pwd=admin1;database=企业信息资源');
{建立一个数据集对象,并从数据表中提取数据}
Rec1 :=CreateOleObject('ADODB.RecordSet');
Rec1.open( 'select * from 部门 where cdepprop=''制造部门'' order by cdepcode' ,Conn1,3,3,0001);
while not Rec1.Eof do
begin
combobox2.Items.Add (rec1.fields['cdepcode'].value+' '+rec1.fields['cdepname'].value);
rec1.movenext;
end;
rec1.close;
[red]combobox2.Text :=copy(form1.user,1,3)+form1.dept+'test'+form1.Label1.Caption ;[/red]combobox1.Clear ;
{建立一个数据集对象,并从数据表中提取数据}
//Rec1 :=CreateOleObject('ADODB.RecordSet');
Rec1.open( 'select * from 工号 order by 工号 desc' ,Conn1,3,3,0001);
while not Rec1.Eof do
begin
combobox1.Items.Add (rec1.fields['工号'].value+' '+rec1.fields['工程名称'].value);
rec1.movenext;
end;
rec1.close ;
conn1.close ;
end;
end.