Курсовая работа: Разработка базы данных и прикладного программного обеспечения для автобусного парка
end;
procedure TfmMain.dtsrcBusesDataChange(Sender: TObject; Field: TField);
begin
btnBusesEdit.Enabled := ADOQueryBuses.RecordCount <> 0;
btnBusesDelete.Enabled := ADOQueryBuses.RecordCount <> 0;
ppmnBusesEdit.Enabled := ADOQueryBuses.RecordCount <> 0;
ppmnBusesDelete.Enabled := ADOQueryBuses.RecordCount <> 0;
end;
procedure TfmMain.btnRoutesDeleteClick(Sender: TObject);
begin
ADOCommand.CommandText := 'DELETE FROM routes WHERE id='+DBGridRoutes.DataSource.DataSet.Fields[0].AsString;;
ADOCommand.Execute;
ADOCommand.CommandText := 'DELETE FROM stations WHERE routeid='+DBGridRoutes.DataSource.DataSet.Fields[0].AsString;;
ADOCommand.Execute;
ADOCommand.CommandText := 'DELETE FROM stoppoints WHERE routeid='+DBGridRoutes.DataSource.DataSet.Fields[0].AsString;;
ADOCommand.Execute;
ADOTableRoutes.Requery();
ADOQueryStations.Requery;
ADOQueryStopPoints.Requery;
end;
procedure TfmMain.btnStationsDeleteClick(Sender: TObject);
begin
ADOCommand.CommandText := 'DELETE FROM stations WHERE id='+DBGridStations.DataSource.DataSet.Fields[0].AsString;;
ADOCommand.Execute;
ADOCommand.CommandText := 'DELETE FROM stoppoints WHERE stationid='+DBGridStations.DataSource.DataSet.Fields[0].AsString;;
ADOCommand.Execute;
ADOQueryStations.Requery;
ADOQueryStopPoints.Requery;
end;