0

I have this code

Const SQLStatement As String = "DELETE people, account FROM people CROSS JOIN account ON people.peopleID = account.peopleID WHERE uname = @p3 "
command.Parameters.AddWithValue("@p3", username.Value)

When the user inputs the username of an account, that statement should delete the records in two tables the people table and account table

It says that it is successful however when I look up to the database nothing has been changed? I have another one which is add account however that works perfectly fine.

I don't know what is the problem? Is it in my syntax?

user2172157
  • 35
  • 2
  • 6
  • 2
    Use cascading to delete the `account` records when a `people` record is deleted. See [this](http://stackoverflow.com/a/4839927/3155705) – JW Lim Mar 25 '14 at 03:37
  • @LeeSalminen you can. https://dev.mysql.com/doc/refman/5.0/en/delete.html – bansi Mar 25 '14 at 03:37
  • @user2172157, what kind of error you getting and paste that error line – jmail Mar 25 '14 at 04:07
  • Sorry but I made a mistake, apparently it was the ID (primary key) that is causing the problem because the ID of two tables are different where they should be the same. I had to set the AUTO INCREMENT of two tables the same for the delete to happen. Thanks for helping everyone. – user2172157 Mar 25 '14 at 04:11

0 Answers0