我可以调用一个SQL Server触发一个C#功能? [英] Can I call a C# function by a SQL Server trigger?
问题描述
这是外部应用程序来我的数据库在SQL Server表中插入一行。
An external application come to my database for inserting row in a Sql server table.
我有我自己的Web应用程序,我想在这个表中的每个插入,做一些treatement服务器端。
I have a web application on my own, and I want on each insert in this table, do some treatement server side.
我的想法是创建一个桌子上插入一个触发器,然后调用相应的函数。
My idea is to create a trigger on insert on the table, and then call appropriate function.
什么是做到这一点的最好方法是什么?
What is the best way to do this ?
我用框架3.5的LINQ to SQL和SQL Server 2005数据库。
I use framework 3.5 with LINQ to SQL, and a SQL Server 2005 database.
修改:谢谢你的答案。
SQL Server的CLR集成不能做到这一点。支持的一些库不符合我的要求。
Edit : Thank you for the answers. SQL Server CLR integration doesn't do it. The few libraries supported doesn't meet me requirement.
我必须登录将采取一个新的记录,每5分钟也许,没有那么多的表格。
也许我可以有工作在餐桌上的每一分钟,看ID听,采取一切新的ID,做我的treatement。
是我的解决方案不是太丑陋?
The table I have to log will take a new record every 5 minutes perhaps, not so much. Maybe I can have a job listening at the table every minute, look at the ID, take all the new ID, do my treatement. Is my solution not too ugly ?
推荐答案
使用SQL Server的CLR集成。
Use SQL Server CLR integration.
http://msdn.microsoft。 COM / EN-US /库/ ms254963%28V = VS.80%29.aspx
这篇关于我可以调用一个SQL Server触发一个C#功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!