在c#win中开发SQL的触发器。形成 [英] develop a trigger for SQL in c# win. form

查看:59
本文介绍了在c#win中开发SQL的触发器。形成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为SQL开发一个触发器。当我保存,更新或删除特定数据库中的任何记录时,触发器应该被触发。







我想在数据保存,更新或删除时再次填写我的数据。



这可能吗?如果是,您可以提供示例代码吗?在此先感谢。

i want to develop a trigger for SQL. The trigger should get triggered when i save,update or delete any record in a particular database.

Or

I want to fill my data again only if data has been saved,updated or deleted.

Is this possible? If yes could you provide with a sample code? Thanks in advance.

推荐答案

这里是一篇关于触发器的好文章
Here is a good article on triggers


他似乎要求触发一个触发他的胜利形式的触发器。编写可以从SQL调用的C#代码是可能的,但是您需要使用该代码调用外部代码来提供某种事件。这根本不是微不足道的,我不推荐它。事实上,因为网络需要是公共层,让你的代码HOST成为一个网络服务是我能想到的唯一方法。



触发器如果你是从C#,C ++或Applesoft basic调用它,你的数据库并不关心你的数据库。因此,它没有外部事件的机制。



要做的事情就是定期轮询你的数据库以查看它是否发生了变化。
He seems to be asking for a trigger that fires to his win form. It's possible to write C# code that you can call from SQL, but you'd need that code to call something external to provide some sort of event. It's not at all trivial, and I don't recommend it. In fact, as the web would need to be the common layer, having your code HOST a web service is the only way I can think to make this work.

Triggers fire inside your DB, your DB does not care if you're calling it from C#, from C++ or from Applesoft basic. As such, it has no mechanisms for external events.

The thing to do is simply to poll your DB regularly to see if it's changed.


这篇关于在c#win中开发SQL的触发器。形成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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