且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在c#中从sql server运行代码

更新时间:2022-11-27 14:07:16

你不能像那样混合和匹配 SQL 和 c# 代码.有一种方法可以通过使用称为 SQL CLR 的功能在 SQL Server 2005+ 上运行 .net 代码,但您可以执行的操作存在限制.这是一个教程:如何:创建和运行 CLR SQL Server 用户定义函数 (原始链接).

You can't really mix and match SQL and c# code like that. There is a way of running .net code on SQL server 2005+ by using a feature called SQL CLR but there are limitations to what you can do. Here is a tutorial: How to: Create and Run a CLR SQL Server User-Defined Function (original link).

您还可以创建其他内容,例如 SQL CLR 触发器和存储过程.研究 SQL CLR 以获取更多信息.

There are other things you can create such as SQL CLR triggers and Stored procedures. Research SQL CLR for more info.