I have two delete statements that i have converted into Update statements. So when they hit delete it does a logical delete instead of a physical delete. I have a Delete column in the DB that just gets updated to a "1" when it is deleted.
Here are the statements:
Deleting a Device:
Deleting a User:
what i am trying to do is perform the Update then perform an Insert into an audit history that I have. The error that gets prompted for both deletes is "Must declare the scalar variable @USER_ID" - I have it declared in my DeleteParameters
Any Ideas?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
Here are the statements:
Deleting a Device:
Code:
DeleteCommand="UPDATE [AMA_DEVICE] SET [DELETED] = '1' WHERE [ID] = @ID; INSERT INTO [AMA_Device_History] ([USER_ID], [DEVICE_ID], [ACTION], [DATE_TIME]) VALUES (@USER_ID, @DEVICE_ID, 'DELETED', dateadd(hour,-2,getdate()))"
<DeleteParameters>
<asp:Parameter Name="DEVICE_ID" Type="String" />
<asp:Parameter Name="MANUFACTURER" Type="String" />
<asp:Parameter Name="MODEL" Type="String" />
<asp:Parameter Name="CARRIER" Type="String" />
<asp:Parameter Name="STATUS" Type="String" />
<asp:Parameter Name="USER_ID" Type="String" />
<asp:Parameter Name="LOCATION" Type="String" />
<asp:Parameter Name="NOTES" Type="String" />
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
Deleting a User:
Code:
DeleteCommand="INSERT INTO [AMA_User_History] ([USER_ID], [ACTION], [DATE_TIME]) VALUES (@USER_ID, 'Deleted', dateadd(hour,-2,getdate())); UPDATE [AMA_User] SET [DELETED] = '1' WHERE [ID] = @ID"
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="USER_ID" Type="String" />
</DeleteParameters>
what i am trying to do is perform the Update then perform an Insert into an audit history that I have. The error that gets prompted for both deletes is "Must declare the scalar variable @USER_ID" - I have it declared in my DeleteParameters
Any Ideas?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008