如何通过EntLib 5.0将表值参数传递给SQL Server 2008?

8

如何通过EntLib 5.0将表值参数传递给SQL Server 2008?


非常有兴趣听听是否/如何可能。 - TarasB
2个回答

0

祝你好运... http://msdn.microsoft.com/zh-cn/library/bb675163.aspx 引用:

Limitations of Table-Valued Parameters

There are several limitations to table-valued parameters:

You cannot pass table-valued parameters to CLR user-defined functions.

Table-valued parameters can only be indexed to support UNIQUE or PRIMARY KEY constraints.
SQL Server does not maintain statistics on table-valued parameters.

Table-valued parameters are read-only in Transact-SQL code.
You cannot update the column values in the rows of a table-valued parameter and you cannot insert or delete rows.
To modify the data that is passed to a stored procedure or parameterized statement
in table-valued parameter, you must insert the data into a temporary  table or into a table variable.

You cannot use ALTER TABLE statements to modify the design of table-valued parameters.

0

我没有尝试过这样做,但是快速查看了EntLib数据块后,我没有发现一个简单的方法来实现这个。你可以使用SqlClient对象来完成,但是EntLib不支持你需要传递数据作为TVP的结构化数据类型。

如果你保证永远不需要除了SQL Server后端之外的任何东西,那么我想你可以将连接转换为特定于SQLServer的连接,然后使用SqlParameters,但这有点违背了使用EntLib的目的。


谢谢您的输入。我也没有看到明显的方法,所以我只是使用了ADO.NET来完成它。那其实还不错。 :) - birdus
目前不支持该功能,因为它是 Sql 2008 才有的特性,并且我们没有收到很多客户要求添加它的请求。 - Chris Tavares

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接