G
Guest
I'm working on creating audit trail functionality for a table in SQL Server that gets its data from my VB.Net program. Everything worked fine while I just had the Insert and Delete triggers. However, upon adding the Update trigger, I noticed that the following code will do something that SQL considers an update before performing the actual insert. So, I get an Update-from and an Update-to line in the table that's full of nulls before the actual Insert takes place
So, the question: Is ExecuteNonQuery causing this? If so, is there a better way to make it only an Insert from this code
Thank
' Create the INSERT command for Sql Server
strInsert = "INSERT INTO tblBaseline (Patient_Name, Test_Date, DOB, MRNum," &
" Height, Weight, TestDesc, Gender, DiskStor," &
" TST, Latency, Efficiency, LimbMove, RDI_TST," &
" RDI_Rem, RDI_Sup, REvtWDesat, REvtWoDesat," &
" LegMove, Spontaneous, AvgO2Wake, AvgO2NRem," &
" ApxMinO2, NumEvtWDesat) VALUES ('
For j = 1 To 2
strInsert = strInsert & strData(j) & "','
Nex
strInsert = strInsert & strData(24) & "')
' Submit INSERT command to the database
BiosSqlCommand.CommandText = strInser
BiosSqlCommand.ExecuteNonQuery()
So, the question: Is ExecuteNonQuery causing this? If so, is there a better way to make it only an Insert from this code
Thank
' Create the INSERT command for Sql Server
strInsert = "INSERT INTO tblBaseline (Patient_Name, Test_Date, DOB, MRNum," &
" Height, Weight, TestDesc, Gender, DiskStor," &
" TST, Latency, Efficiency, LimbMove, RDI_TST," &
" RDI_Rem, RDI_Sup, REvtWDesat, REvtWoDesat," &
" LegMove, Spontaneous, AvgO2Wake, AvgO2NRem," &
" ApxMinO2, NumEvtWDesat) VALUES ('
For j = 1 To 2
strInsert = strInsert & strData(j) & "','
Nex
strInsert = strInsert & strData(24) & "')
' Submit INSERT command to the database
BiosSqlCommand.CommandText = strInser
BiosSqlCommand.ExecuteNonQuery()