|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I'm working in Visual Basic with MySql as data base server using innodb tables.
I made a foreign key between 2 tables with a restriction ON DELETE NO ACTION. But when I delete a row on a parent table, the foreign key doesn't restrict the operation. What can i do? Thanks in advance. |
|
#2
|
|||
|
|||
|
Just some ideas off the top of my head.
Are you using:
Remember that InnoDB does not auto-create indexes. You must create these manually! What syntax did you use to create the constraint? |
|
#3
|
|||
|
|||
|
I made all the steps you wrote, but it doesn't work .
The syntax I used is: ALTER TABLE cabfac add constraint clientes foreign key (codCliente) references clientes (codCliente) on delete no action on update no action; |
|
#4
|
|||
|
|||
|
I can't check the syntax until I see the two tables you have referenced. Can you post the table structures (cabfac & clientes)?
Also, did you create the indexes BEFORE you made the Foreign Key constraints? That's an important step. |
|
#5
|
|||
|
|||
|
ANSI SQL-92 ON DELETE NO ACTION not supported by MySQL
Hi,
Not sure whether my reply will reach you as this thread is a bit ancient, but the problem you have encountered is due to a discrepancy in the way MySQL implements the NO ACTION option compared with the ANSI SQL-92 standard and most other relational database systems. I have put a comment about this in Section 14.4.5.2 FOREIGN KEY Constraints in the MySQL online documentation, which reads as follows: A further deviation from ANSI SQL-92 standards, at the time of writing, is the way MySQL treats the ON DELETE NO ACTION and ON UPDATE NO ACTION clauses, should you attempt to use them. I hope this helps you, or anyone else who has been puzzled by this behaviour. ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Foreign key in MySQL with Visual Basic doesn't work |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|