Курсовая работа: Разработка базы данных и прикладного программного обеспечения для автобусного парка
ADOQueryRoutes.Open;
ADOQueryRoutes.Requery;
lcmbbxRoute.DropDown;
end;
procedure TfmStopPoints.btnOKClick(Sender: TObject);
begin
if (ledName.Text <> '') and (lcmbbxRoute.Text <> '') and (lcmbbxStation.Text <> '') then
begin
if EditFlag then
begin
fmMain.ADOCommand.CommandText := 'UPDATE stoppoints SET name=''' + ledName.Text
+ ''', routeid=' + IntToStr(lcmbbxRoute.KeyValue) + ', direction=''' +
cmbbxDirection.Text + ''', stationid=' + IntToStr(lcmbbxStation.KeyValue)
+ ' WHERE id=' + fmMain.DBGridStopPoints.DataSource.DataSet.Fields[0].AsString;
end
else
begin
fmMain.ADOCommand.CommandText :=
'INSERT INTO stoppoints (name, direction, stationid, routeid) VALUES ('''
+ ledName.Text + ''', ''' + cmbbxDirection.Text + ''', ' +
IntToStr(lcmbbxStation.KeyValue) + ', ' + IntToStr(lcmbbxRoute.KeyValue) + ')';
end;
fmMain.ADOCommand.Execute;
fmMain.ADOQueryStopPoints.Requery;
close;
end
else
ShowMessage('Incorrect parameters!');
end;