Answer the question
In order to leave comments, you need to log in
How to link two delphi tables?
Good afternoon! I'm new, so don't judge too harshly.
The bottom line is this: I have a program with a database where there are 5 tables. In the sales table , when adding, I specify the consultant from the employees table . In the employees table itself , I have a column called "number of sales". The bottom line is that when adding any sale, I have 1 added to the "number of sales" for a certain employee.
I work through ADOTable. Hopefully the screenshots will make things clearer.
On the save button in the "Add sale" form, I decided to insert the following code:
form1.ADOTable3.first; \\ ADOTable3 - таблица с сотрудниками, ADOTable2 - таблица с продажами
sotrud:=form1.ADOTable3.FieldByName('ФИО').asstring;
while not form1.ADOTable3.eof do
begin
if dbcombobox2.text = sotrud then \\ в dbcombobox отображаются ФИО из таблицы "сотрудники"
\\ тут не знаю, какой код написать, чтобы в таблице сотрудники, в столбце кол-во продаж, у меня прибавлялось 1
end;
Answer the question
In order to leave comments, you need to log in
form1.ADOTable3.first; \\ ADOTable3 - таблица с сотрудниками, ADOTable2 - таблица с продажами
sotrud:=form1.ADOTable3.FieldByName('ФИО').asstring;
while not form1.ADOTable3.eof do
begin
if dbcombobox2.text = sotrud then \\ в dbcombobox отображаются ФИО из таблицы "сотрудники"
begin
ADOTable3.FieldByName('название поля с числом').AsInteger := ADOTable3.FieldByName('название поля с числом').AsInteger + 1;
Brake;
end;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question