Создание базы данных “Библиотека”, страница 3

Нажатие кнопки «Следующий»

if recno() < reccount() then

  skip

  thisform.country.value=country

endif

Нажатие кнопки «Добавить»

dimension b(1)

select max(id_c) from countries into array b

c = b(1)+1

append blank

replace id_c with c

replace country with thisform.country.value

Нажатие кнопки «Удалить»

delete

if (id_c!=1)

  skip -1

  thisform.country.value=country

endif 

pack

Нажатие кнопки «Назад»

thisform.release()

do form main

Нажатие кнопки «Просмотр»

Browse

Форма ввода данных таблицы «Книги»

Код, используемый для работы с таблицей:

Активация формы

close tables all

use books

go top

thisform.book_name.value=book_name

thisform.date_writing.value=date_writing

thisform.cost.value=cost

dimension a(1)

select countries.country from data1!countries,data1!books;

  where countries.id_c=books.id_c AND;

    books.book_name = thisform.book_name.value and;       

      books.date_writing = thisform.date_writing.value and;             

        books.cost = thisform.cost.value;           

    into array a

thisform.country.value=a(1)

dimension b(1)

select authors.lname from data1!authors,data1!books;

  where authors.id_author=books.id_author AND;

    books.book_name = thisform.book_name.value and;       

      books.date_writing = thisform.date_writing.value and;             

        books.cost = thisform.cost.value;           

    into array b

thisform.author.value=b(1)

Нажатие кнопки «Предыдущий»

if recno() > 1 and id_author!=1 then

      skip -1

thisform.book_name.value=book_name

thisform.date_writing.value=date_writing

thisform.cost.value=cost

dimension a(1)

select countries.country from data1!countries,data1!books;

  where countries.id_c=books.id_c AND;

    books.book_name = thisform.book_name.value and;       

      books.date_writing = thisform.date_writing.value and;             

        books.cost = thisform.cost.value;           

    into array a

thisform.country.value=a(1)

dimension b(1)

select authors.lname from data1!authors,data1!books;

  where authors.id_author=books.id_author AND;

    books.book_name = thisform.book_name.value and;       

      books.date_writing = thisform.date_writing.value and;             

        books.cost = thisform.cost.value;           

    into array b

thisform.author.value=b(1)

endif

Нажатие кнопки «Следующий»

if recno() < reccount() then

  skip

thisform.book_name.value=book_name

thisform.date_writing.value=date_writing

thisform.cost.value=cost

dimension a(1)

select countries.country from data1!countries,data1!books;

  where countries.id_c=books.id_c AND;

    books.book_name = thisform.book_name.value and;       

      books.date_writing = thisform.date_writing.value and;             

        books.cost = thisform.cost.value;           

    into array a

thisform.country.value=a(1)

dimension b(1)

select authors.lname from data1!authors,data1!books;

  where authors.id_author=books.id_author AND;

    books.book_name = thisform.book_name.value and;       

      books.date_writing = thisform.date_writing.value and;             

        books.cost = thisform.cost.value;           

    into array b

thisform.author.value=b(1)

endif

Нажатие кнопки «Добавить»

dimension a(1)

select countries.id_c from data1!countries,data1!books;

  where countries.country= thisform.country.value;        

    into array a

dimension b(1)

select authors.id_author from data1!authors,data1!books;

  where authors.lname=thisform.author.value;        

    into array b   

append blank

replace id_c with a(1)

replace id_author with b(1)

replace book_name with thisform.book_name.value

replace date_writing with thisform.date_writing.value

replace cost with thisform.cost.value

Нажатие кнопки «Удалить»

delete

if (id_author!=1)

  skip -1

thisform.book_name.value=book_name

thisform.date_writing.value=date_writing

thisform.cost.value=cost

dimension a(1)

select countries.country from data1!countries,data1!books;

  where countries.id_c=books.id_c AND;

    books.book_name = thisform.book_name.value and;       

      books.date_writing = thisform.date_writing.value and;             

        books.cost = thisform.cost.value;           

    into array a

thisform.country.value=a(1)

dimension b(1)

select authors.lname from data1!authors,data1!books;

  where authors.id_author=books.id_author AND;

    books.book_name = thisform.book_name.value and;