Hello,
Am wondering if someone can give me a pointer on where to start with a query i have.
What i am trying to do is provide some sort of information to a user that data from a database has been changed. I know that you can cache a page and have output cache directive invalidate it next time it loads if changed but wondering if its poss to be told its changed without reload ( dont see how but never know) - even if not on that page.
What im kinda thinking is something like the popup that outlook has when a new message arrives in in box. Is that just sending a new query? is there a table last modified function in sql? etc.
This is for a web app in c#.
Any help would be appreaciated.
cheers
HI Dear,
you have to use SQLCacheDependency Class for this purpose
I think following article will help you in this regard
http://www.c-sharpcorner.com/UploadFile/mosessaur/sqlcachedependency01292006135138PM/sqlcachedependency.aspx?ArticleID=3caa7d32-dce0-44dc-8769-77f8448e76bc
http://www.ondotnet.com/pub/a/dotnet/2005/01/17/sqlcachedependency.html
Thanks
Best Regards,
Muhammad Akhtar Shiekh
|||Hey thanks for direct.
What i think i need is my own trigger for the changing table but not sure how to write the things - a bit diff from normal to me.
How would i write a trigger that on an update of table that has the trigger updates a value eg change the date value, in another table?
eg
insert / update row in mainTable which has a colomn 'myName' - fires trigger - trigger gets 'myName' from the insert/update and enters date (getdate()) into changeTable where 'myName' = 'myName'
ALTER TRIGGER update_Trigger
ON dbo.mainTable
AFTER UPDATE
AS
BEGIN
UPDATE changeTable
SET ....? // what would i write here?
END
Not sure how to do this so any help would be great
Cheers, cliff
|||Dont worry, sorted it.
Cheers
ALTER TRIGGER
update_TriggerON
dbo.mainTableAFTER UPDATE
AS
DECLARE
@.newNameNVARCHAR(50)UPDATE
changeTableSETdatechange =getdate()WHERE
username = (SELECTmyNameFROMInserted)
No comments:
Post a Comment