Welcome to Abdul Malik Ikhsan's Blog

Error Handling Cancel data (delphi-red)

Posted in Tutorial Delphi by samsonasik on January 13, 2007

procedure TFMintaBarang.BitBtnCancelClick(Sender: TObject);
begin
if (not ((ADOTable1.State=dsEdit) or (adotable1.State=dsInsert)))
then
begin
if (adotable1.MaxRecords=0)
then
begin
BitBtn10.Enabled:=true;
BitBtn11.Enabled:=true;
BitBtn12.Enabled:=true;
BitBtn13.Enabled:=true;
BitBtn14.Enabled:=true;
BitBtn15.Enabled:=true;
ADOConnection1.Close;
DataSource1.DataSet.Close;
ADOTable1.Close;
ADOConnection1.Open;
DataSource1.DataSet.Open;
ADOTable1.Open;
end
else
begin
BitBtn10.Enabled:=true;
BitBtn11.Enabled:=true;
BitBtn12.Enabled:=true;
BitBtn13.Enabled:=true;
BitBtn14.Enabled:=true;
BitBtn15.Enabled:=true;
ADOConnection1.Close;
DataSource1.DataSet.Close;
ADOTable1.Close;
ADOConnection1.Open;
DataSource1.DataSet.Open;
ADOTable1.Open;
exit;
end;
end;
if ((adotable1.State=dsEdit) or (ADOTable1.State=dsInsert))
then
begin
if (ADOTable1.MaxRecords=0)
then
begin
showmessage(‘Tidak jadi Update Data’);
BitBtn10.Enabled:=true;
BitBtn11.Enabled:=true;
BitBtn12.Enabled:=true;
BitBtn13.Enabled:=true;
BitBtn14.Enabled:=true;
BitBtn15.Enabled:=true;
ADOConnection1.Close;
DataSource1.DataSet.Close;
ADOTable1.Close;
ADOConnection1.Open;
DataSource1.DataSet.Open;
ADOTable1.Open;
end
else
begin
BitBtn10.Enabled:=true;
BitBtn11.Enabled:=true;
BitBtn12.Enabled:=true;
BitBtn13.Enabled:=true;
BitBtn14.Enabled:=true;
BitBtn15.Enabled:=true;
ADOConnection1.Close;
DataSource1.DataSet.Close;
ADOTable1.Close;
ADOConnection1.Open;
DataSource1.DataSet.Open;
adotable1.Open;
exit;
end ;
end;
end;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: