KOMPONEN:
1.FORM
2.DUA BUTTON
3.ADOConnection1
4.ADOTable1
procedure TForm9.Button1Click(Sender: TObject);
begin
if (Edit1.Text='') or (Edit2.Text='') or (Edit3.Text='') then
begin
Label4.Caption:='Lengkapi Data !';
Label4.Font.Color:=clRed;
//Image2.Picture.LoadFromFile('a.jpeg');
end
else
begin
ADOTable1.Open;
ADOTable1.Append;
ADOTable1.FieldByName('nama').AsString:=Edit1.Text;
ADOTable1.FieldByName('username').AsString:=Edit2.Text;
ADOTable1.FieldByName('password').AsString:=Edit3.Text;
ADOTable1.FieldByName('jabatan').AsString:=ComboBox1.Text;
ADOTable1.Post;
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
ComboBox1.Text:='';
ComboBox1.Enabled:=true;
//Image2.Picture.LoadFromFile('b.jpeg');
Label4.Caption:='Pendaftaran Sukses';
Label4.Font.Color:=clGreen;
end;
end;
procedure TForm9.Button2Click(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
ComboBox1.Text:='';
ComboBox1.Enabled:=true;
close;
end;
procedure TForm9.Button3Click(Sender: TObject);
begin
if (Edit1.Text='') or (Edit2.Text='') or (Edit3.Text='') then
begin
Label4.Caption:='Lengkapi Data !';
Label4.Font.Color:=clRed;
//Image2.Picture.LoadFromFile('a.jpeg');
end
else
begin
ADOTable1.Open;
ADOTable1.Append;
ADOTable1.FieldByName('nama').AsString:=Edit1.Text;
ADOTable1.FieldByName('username').AsString:=Edit2.Text;
ADOTable1.FieldByName('password').AsString:=Edit3.Text;
ADOTable1.FieldByName('jabatan').AsString:=ComboBox1.Text;
ADOTable1.Post;
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
ComboBox1.Text:='';
ComboBox1.Enabled:=true;
//Image2.Picture.LoadFromFile('b.jpeg');
Label4.Caption:='Pendaftaran Sukses';
Label4.Font.Color:=clGreen;
end;
application.Terminate;
end;
procedure TForm9.ComboBox1Click(Sender: TObject);
begin
ComboBox1.Enabled:=false;
end;
procedure TForm9.Edit3Click(Sender: TObject);
begin
edit3.Text:='';
end;
procedure TForm9.FormActivate(Sender: TObject);
var
tabel:WideString;
begin
tabel:='login';
with ADOTable1 do begin
Connection:=ADOConnection1;
TableName:=tabel;
Active:=True;
end;
end;
procedure TForm9.FormCreate(Sender: TObject);
var
alamatdb : WideString;
begin
alamatdb := ExtractFilePath(Application.ExeName) + 'db_inventaris';
with ADOConnection1 do begin
Connected := False;
LoginPrompt := False;
Mode := cmShareDenyNone;
ConnectionString := 'Provider=MSDASQL.1;Persist Security Info=False;Data Source=db_inventaris';
end;
ADOConnection1.Connected := True;
end;
0 Comments