我的数据库中有两个表CurrentStock 和Inventory ,两个表中都有cInvCode 字段,
现在就是想修改里面的内容,出现上面的错误

解决方案 »

  1.   

    Inventory表以cInvCode作主索引CurrentStock表 以AutoId作主索引
      

  2.   

    Create database cat
    go
    use cat
    go
    CREATE TABLE s(s# int not null primary key,s_name varchar(8) not null)
    go
    CREATE TABLE c (c# int not null primary key,c_name varchar(8) not null)
    go
    CREATE TABLE cs(c# int not null,s# int not null,cj tinyint not null default(0),
    primary key (c#,s#),foreign key(s#) references s(s#),foreign key(c#) references c(c#))
    go
    insert s values(1,'saa')
    insert c values(1,'caa')--这句是对的
    insert cs values(1,1,86)--这句是错的,sql会报错,应为s表的s#列里没有2
    insert cs vlaues(2,1,45)你犯的错和上面一样