tags:

views:

16

answers:

0

How do I retrieve a datarow, store it, then update the datarow with new data and then return the old data? I can't seem to get this code working.

My 1st datarow: (getNewNotifications)

SELECT id,username,notification,active FROM notifications WHERE username=?username AND active=1 ORDER BY id DESC

My updated datarow: (updateNotifications)

UPDATE notifications SET active=0 WHERE id=?id

My actual event code:

var tmp = _snippets.getNewNotifications(username).Rows[0];

var notification = tmp["notification"].ToString();
var id = Convert.ToInt16(tmp["id"].ToString());

_snippets.updateNotifications(id);

return notification;

When I return the above data, it returns the updated data, but I want it to return the old data before it got updated. How do I somehow manage that? My method is static and takes username as a parameter.