Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > Базы данных
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 22.04.2010, 16:27
Андреи4 Андреи4 вне форума
Прохожий
 
Регистрация: 22.04.2010
Сообщения: 5
Репутация: 10
По умолчанию Не добавляются записи

при выполнении кода, возникает ошибка, показанная на рисунке.
все таблицы связаны 1-1 по полю pupilId. таблицы pupil главная. не для каждой записи таблицы pupils есть соответствующая в таблице Disability. база в акцессе.
Код:
  Datamodule2.pupil.append;
  if family.Text<>#0 then
    datamodule2.pupil.FieldByName('sername').AsString:=Family.Text;
  if ima.Text<>#0 then
    datamodule2.pupil.FieldByName('Nam').AsString:=ima.Text;
  if otchestvo.Text<>#0 then
    datamodule2.pupil.FieldByName('Fname').AsString:=otchestvo.Text;
  datamodule2.pupil.FieldByName('Pol').AsString:=pol.Text;
  if birthday.Text<>da then
    datamodule2.pupil.FieldByName('Birthday').AsDateTime:=strtodate(birthday.Text);
  if adress.Text<>#0 then
    datamodule2.pupil.FieldByName('Adress').AsString:=(adress.Text);
  if phone.Text<>DT then
    datamodule2.pupil.FieldByName('Phone').AsString:=phone.Text;
  datamodule2.pupil.Post;

  datamodule2.school.Append;
  datamodule2.school.FieldByName('pupilid').AsInteger:=datamodule2.pupil.FieldByName('pupilid').AsInteger;
  if clas.text<>#0 then
    datamodule2.school.FieldByName('GodObuch').AsInteger:=strtoint(clas.Text);
  if osh.Text<>#0 then
    datamodule2.school.FieldByName('Class').AsInteger:=strtoint(osh.Text);
  datamodule2.school.FieldByName('progid').AsInteger:=progr.ItemIndex+1;
  datamodule2.school.FieldByName('formid').AsInteger:=forma.itemindex+1;
  if zachisl.text<>da then
    datamodule2.school.FieldByName('zach').AsDateTime:= Strtodate(zachisl.Text);
  if putevka.text<>#0 then
    datamodule2.school.FieldByName('putevka').AsString:=putevka.text;
  if pmpk.text<>Dt then
    datamodule2.school.FieldByName('pmpk').AsString:=pmpk.Text;
  if dz.text<>#0 then
    datamodule2.school.FieldByName('zabolevanie').AsString:=Dz.Text;
  datamodule2.school.FieldByName('disability').AsBoolean:=disability.Checked;
  datamodule2.school.FieldByName('logoped').AsBoolean:=logoped.Checked;
  datamodule2.school.FieldByName('GPD').AsBoolean:=gpd.Checked;
  datamodule2.school.FieldByName('ssd').AsBoolean:=ccd.Checked;
  datamodule2.school.Post;

  datamodule2.parents.Append;
  datamodule2.parents.FieldByName('pupilid').AsInteger:=datamodule2.pupil.FieldByName('pupilid').AsInteger;
  if momfio.Text=#0 then
    datamodule2.parents.FieldByName('mother').AsString:=momfio.Text;
  if momphone.Text=MT then
    datamodule2.parents.FieldByName('phoneMother').AsString:=momphone.Text;
  if dadfio.Text=#0 then
    datamodule2.parents.FieldByName('father').AsString:=dadfio.Text;
  if dadphone.Text=MT then
    datamodule2.parents.FieldByName('PhoneFather').AsString:=dadphone.Text;
  datamodule2.parents.Post;

  if disability.checked then
  begin
    datamodule2.disability.Append;
    datamodule2.disability.FieldByName('pupilid').AsInteger:=datamodule2.pupil.FieldByName('pupilid').AsInteger;
    if nomer.Text=#0 then
      datamodule2.disability.FieldByName('nospravki').AsString:=nomer.Text;
    if beg.Text=dt then
      datamodule2.parents.FieldByName('beg').AsString:=beg.Text;
  end;
Изображения
Тип файла: jpg error.JPG (26.5 Кбайт, 5 просмотров)
Ответить с цитированием
Ответ


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 08:24.


 

Сайт

Форум

FAQ

RSS лента

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2023

ВКонтакте   Facebook   Twitter