这些是我的表格:
tbl_student (studID,Firstname)
我的专注是 priid
finger_template(Detail_ID,FingerprintMask)
我想删除tbl_student
和finger_template
中的记录。这是我的查询:
command = New MySqlCommand("DELETE from tbl_student where studid='" & priid & "'", connection, transaction)
希望有人会帮助
答案 0 :(得分:1)
表:tbl_student
+-------------+-----------+
| studID (PK) | Firstname |
+-------------+-----------+
| **000001** | John |
+-------------+-----------+
表:finger_template
+----------------+-----------------+-------------+
| Detail_ID (PK) | FingerprintMask | studID (FK) |
+----------------+-----------------+-------------+
| 000001 | SampleMask | **000001** |
+----------------+-----------------+-------------+
如果tbl_student studID
PK链接到finger_template stuID
FK
你只需删除studID
PK,FK也会被删除DELETE FROM tbl_student WHERE studID=000001