Hi,
I have an access2k db which has 3 tables containing info about products. The first table has a autonumber field "id_product" which I use in the 2 other tables (one to many relation). I have no problem retrieving the info using datashaping.
But, when I try to delete a product, it gets deleted from the first table (where there is only one occurence of the id_product number) and from the second (where there are more than one occurence of id_product) but not from the third table.
Here is the code I'm using:
It executes the first and second delete then I get a syntaxe error in the from clause when it tries to execute the third sql delete command.
Any suggestions?
Thanks.
I have an access2k db which has 3 tables containing info about products. The first table has a autonumber field "id_product" which I use in the 2 other tables (one to many relation). I have no problem retrieving the info using datashaping.
But, when I try to delete a product, it gets deleted from the first table (where there is only one occurence of the id_product number) and from the second (where there are more than one occurence of id_product) but not from the third table.
Here is the code I'm using:
Code:
<%
id_prod = Request.form("id_prod")
sqla = "DELETE FROM prod_fr WHERE id_prod = " & id_prod & ";"
sqlb = "DELETE FROM tech WHERE id_prod = " & id_prod & ";"
sqlc = "DELETE FROM image WHERE id_prod = " & id_prod & ";"
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\path\database.mdb"
Set cnn = Server.CreateObject("ADODB.Connection")
cnn.Open strConn
Set cmn = Server.CreateObject("ADODB.Command")
Set cmn.ActiveConnection = cnn
cmn.CommandText = sqla
cmn.Execute ,,adCmdText + adExecuteNoRecords
cmn.CommandText = sqlb
cmn.Execute ,,adCmdText + adExecuteNoRecords
cmn.CommandText = sqlc
cmn.Execute ,,adCmdText + adExecuteNoRecords
cnn.close
%>
It executes the first and second delete then I get a syntaxe error in the from clause when it tries to execute the third sql delete command.
Any suggestions?
Thanks.