Question about auto increment field

i am making an application with master/detail dataset, and the  detail
dataset include a identify column. when i new a record in detail
dataset and post it, system show error message 'Multiple records found,
but only one expected'. why? i used delphi 5 and sybase 11.x.

sorry for my poor English!

please see my sample program! i create two tables such as:

create table A
(
    AF1  numeric              identity,
    AF2  char(10)              not null,
    AF3  varchar(30)          not null,
    constraint PK_A primary key (AF1)
)
go

create table B
(
    AF1  numeric              not null,
    BF1  numeric              identity,
    BF2  char(10)              not null,
    BF3  varchar(30)          not null,
    constraint PK_B primary key (AF1, BF1)
)
go

create index RELATION_15_FK on B (AF1)
go

alter table B
    add constraint FK_B_RELATION__A foreign key  (AF1)
      references A (AF1)
go

unit1.frm

object Form1: TForm1
  Left = 192
  Top = 107
  Width = 544
  Height = 375
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object DBGrid1: TDBGrid
    Left = 0
    Top = 0
    Width = 536
    Height = 153
    Align = alTop
    DataSource = DataSource1
    TabOrder = 0
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'MS Sans Serif'
    TitleFont.Style = []
  end
  object DBGrid2: TDBGrid
    Left = 0
    Top = 153
    Width = 536
    Height = 195
    Align = alClient
    DataSource = DataSource2
    TabOrder = 1
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'MS Sans Serif'
    TitleFont.Style = []
  end
  object Table1: TTable
    DatabaseName = 'Sale_System'
    TableName = 'dbo.A'
    Left = 40
    Top = 24
  end
  object DataSource1: TDataSource
    DataSet = Table1
    Left = 96
    Top = 16
  end
  object Table2: TTable
    DatabaseName = 'Sale_System'
    IndexFieldNames = 'AF1'
    MasterFields = 'AF1'
    MasterSource = DataSource1
    TableName = 'dbo.B'
    Left = 144
    Top = 136
  end
  object DataSource2: TDataSource
    DataSet = Table2
    Left = 184
    Top = 152
  end
end

unit1.pas
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,   Grids, DBGrids, Db, DBTables;

type
  TForm1 = class(TForm)
    Table1: TTable;
    DataSource1: TDataSource;
    Table2: TTable;
    DataSource2: TDataSource;
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Table1.Active:=True;
  Table2.Active:=True;
end;

end.

Sent via Deja.com http://www.deja.com/
Before you buy.