使用触发结果显示在网页上 [英] Use the result of trigger to shown on web page

查看:74
本文介绍了使用触发结果显示在网页上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了触发器,我可以从中获取行数。现在我想表明这个没有。每次执行触发器时网页上的行都会更新。为此我必须在网页上添加并触发,请提供想法和可能的代码。

I have created trigger from which i can get number of rows. now i want to show this no. of rows on webpage which update every time when trigger is executed.for this what i have to add on webpage and trigger please give idea and possible then code also.

CREATE TRIGGER DEMO
ON dbo.t_volunteer
AFTER INSERT
AS
BEGIN
	DECLARE @id INT
	SET @id=(SELECT COUNT(VUID)FROM dbo.t_volunteer)
	PRINT @id
END
GO

推荐答案

你不能得到结果一个触发器,它在数据库中执行,没有你调用它,所以它没有回到你身边的地方。触发器在这里没用,这是一件愚蠢的事情。触发器应在插入后执行以执行数据库操作。如果您想要获取这些数据,请执行存储过程并调用它,或者在也调用它的过程中插入,这样您就可以获取数据并显示它。
you can''t get the result of a trigger, it''s executed inside the DB, without you calling it, so there''s no where for it to come back to you. A trigger is useless here, it''s a dumb thing to do. A trigger should act after an insert to perform a DB operation. If you''re wanting to get this data, do a stored proc and call it, or do your insert in a proc that also calls this, so you can get the data back and show it.


这篇关于使用触发结果显示在网页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆