我正在开发一个摇摆应用程序,在测试期间我遇到了一些更新数据的问题。
我有一张名为“剂量”的表格:
create table Dose (id_dose int auto_increment primary key ,
id_cmd varchar(50),
t_inj TimeStamp,
a_inj int,
id_e_d int,
id_dose_inc varchar(50),
poid int ,
Constraint fkk_et_doses foreign key (id_e_d) references Etat_dose (id_e_d),
Constraint fkk_et_cmds foreign key (id_cmd) references Commande (id_cmd)ON DELETE CASCADE);
id_e_d字段对etat_dose表中的id_e_d 的引用:
create table Etat_dose (id_e_d int primary key,
libele varchar(50));
当我将数据插入其中时,一切正常,为此我使用查询:
Methodes.UpdateData("insert into Dose(id_cmd,t_inj,a_inj,id_e_d,id_dose_inc,poid) values (?,?,?,?,?,?)", dose, 6);
但是当我更新id_e_d时,剂量表中的T_inj会自动更改为系统日期。例如 :
在我插入之前:
insert into doses values(1,'CMFDG121031-1',' 2012-10-02 10:30:55',400,1,'CMFDG121031-1-1',30)
当我编辑它时,我得到:
mysql> select * from dose where id_dose=1;
+---------+---------------+---------------------+-------+--------+-----------------+------+
| id_dose | id_cmd | t_inj | a_inj | id_e_d | id_dose_inc | poid
+---------+---------------+---------------------+-------+--------+-----------------+------+
| 1 | CMFDG121031-1 | 2012-10-02 10:30:55 | 400 | 1 | CMFDG121031-1-1 | 30 |
+---------+---------------+---------------------+-------+--------+-------------------------
在我执行的更新中:
update dose set id_e_d=2 where id_dose=1
我得到:
mysql> select * from dose where id_dose=1;
+---------+---------------+---------------------+-------+--------+-----------------+------+
| id_dose | id_cmd | t_inj | a_inj | id_e_d | id_dose_inc | poid
+---------+---------------+---------------------+-------+--------+-----------------+------+
| 1 | CMFDG121031-1 | 2012-10-08 16:15:11 | 400 | 2 | CMFDG121031-1-1 | 30 |
+---------+---------------+---------------------+-------+--------+-------------------------
如您所见,T_inj的值已自动更改。我能做些什么来追踪这个错误。