Fernando
|
Posted: 01/09/2004, 10:50 AM |
|
Hi every one:
I hope some one could help me,
When the user press delete in a record form, i want to save firts that record in other table with the same fields. I guess that has to be in BeforeDelete but don't know what to do, I'm new in this world.
I'm usign Code Charge Studio 2.1 and ASP
Some body help please
|
|
|
Edd
Posts: 547
|
Posted: 01/09/2004, 4:00 PM |
|
On the BeforeDelete event extract the key fields of what is to be deleted, depending upon your database you can perform a manual insert.
The best way it thru a database trigger but most people here don't use the more complex databases.
in the Before Delete event
Dim DBConn
Dim StrSQL
KeyField1 = Record.KeyField1.value
Field2 = Record.KeyField2.value
Field3 = Record.KeyField3.value
Set DBConn = new clsDBMyDBconnection
DBConn.Open
StrSQL = "Insert into Backuptable (Field1,Field2,Field3) values (" & Field1 & "," & Field2 & "," & Field3 ")"
DBConn.Execute StrSQL
DBConn.Close
Set DBConn = nothing
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
|
|
Fernando
|
Posted: 01/13/2004, 2:13 PM |
|
Thak's a lot Edd, i try just like you said, the record in the first table is deleted but in the second one does'nt happen nothing, i mean, donīt say the record deleted in the second table.
I use this code
Function autos_BeforeDelete() 'autos_BeforeDelete @2-2F55D80A
Dim DBConn
Dim StrSQL
Dim ODT
Dim Cliente
Dim Modelo
Dim Deducible
Dim ImporteDeducible
Dim Ingreso
Dim Salida
ODT = autos.ODT.value
Cliente = autos.Cliente.value
Modelo = autos.Modelo.value
Deducible = autos.Deducible.value
ImporteDeducible = autos.ImporteDeducible.value
Ingreso = autos.Ingreso.value
Salida = autos.Salida.value
Set DBConn = new clsDBmantenimiento
DBConn.Open
StrSQL = "Insert into autos2 (ODT,Cliente,Modelo,Deducible,ImporteDeducible,Ingreso,Salida) values (" & ODT & "," & Cliente & "," & Modelo & "," & Deducible & "," & ImporteDeducible & "," & Ingreso & "," & Salida & ")"
DBConn.Execute StrSQL
DBConn.Close
Set DBConn = nothing
End Function 'Close autos_BeforeDelete @2-54C34B28
any ssuggestion
|
|
|
|