0

These are my tables:

tbl_student (studID,Firstname) 

My studid is priid

finger_template(Detail_ID,FingerprintMask)

I want to delete the record in tbl_student and finger_template. Here's my Query:

command = New MySqlCommand("DELETE from tbl_student where studid='" & priid & "'", connection, transaction)

Hope someone will help

Muhammad Muazzam
  • 2,810
  • 6
  • 33
  • 62

1 Answers1

1

Table: tbl_student

+-------------+-----------+
| studID (PK) | Firstname |
+-------------+-----------+
| **000001**  | John      |
+-------------+-----------+

Table: finger_template

+----------------+-----------------+-------------+
| Detail_ID (PK) | FingerprintMask | studID (FK) |
+----------------+-----------------+-------------+
| 000001         | SampleMask      | **000001**  |
+----------------+-----------------+-------------+

If the tbl_student studID PK is link to finger_template stuID FK you could just simply remove the studID PK and the FK will be remove as well DELETE FROM tbl_student WHERE studID=000001

Matt Magallo
  • 328
  • 1
  • 20