Hey there, I need some help with the trigger setup I have:
CREATE TRIGGER `update` AFTER UPDATE ON `table 1`
FOR EACH ROW INSERT INTO table 2 (
Id,
Revision,
Purpose,
Change
)
VALUES
(
OLD.Id,
OLD.Revision,
OLD.Purpose,
@purpose_change /* user variable */
);
$$ DELIMITER ;
I'm working with C# WebService, Ajax, and JavaScript. Below are my C# methods for update (currently not functioning correctly)
"UPDATE table 1 SET Revision=@revision, Purpose=@purpose, @purpose_change=@change WHERE (Id =@id)";
The issue arises as I am unsure about how to send @purpose_channge properly.
Here's my Web Method.
[WebMethod(EnableSession = true)]
public string UpdateAlert(int id, string revision, string purpose, string change, int op)
{
string response = "An Error Has Occurred.";
try
{
UpdateAlert ua = new UpdateAlert(id, revision, purpose, change);
int resp = conn.UpdateAlerta(ua, op);
if (resp > 0)
response = "Success!.";
}
catch (Exception ex)
{
response = "An Error Has Occurred: " + ex.Message;
}
return response;
}
And here's my JavaScript function with AJAX call.
$.ajax({
type: "POST",
url: urlServer + "ws_alerts.asmx/ActualizarAlerta",
data: '{' +
'"id":' + id +
',"revision":"' + rev +
'","purpose":"' + pur +
'","change":"' + change +
'","op":' + op + '}',
dataType: "json",
contentType: "application/json",
timeout: 60000,
error: function (xhr) {
bootbox.alert("An error occurred while processing the request.");
},
success: function (data) {
bootbox.alert(data.d);
}
});
id, rev, change, etc. values are retrieved using $('#MyId').val()
The main problem lies in the Update query but I am uncertain how to correct it. Any suggestions on what needs to be done?