如何通过EntLib 5.0将表值参数传递给SQL Server 2008?
我还没有尝试过这样做,但已经快速浏览了EntLib数据块,我看不到实现这一点的简单方法。您可以使用SqlClient对象来完成它,但EntLib不支持您需要将数据作为TVP传递的结构化数据类型。
如果你保证不需要任何东西,除了一个SQL Server后端,那么我想你可以把你的连接转换成一个特定于SQLServer的,然后使用SqlParameters,但这会在一定程度上破坏使用EntLib的目的。
感谢您的意见。我也没有看到明显的方式,所以我只是使用ADO.NET来完成它。这并不坏。 :) – birdus 2010-12-20 07:40:53
目前尚不支持它,因为它仅仅是一个Sql 2008功能,并且我们没有收到很多客户请求来添加它。 – 2010-12-23 04:48:11
好运... http://msdn.microsoft.com/en-us/library/bb675163.aspx 报价:
表值参数
的局限性,有若干限制,以表值参数:
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.
很感兴趣听取如何/如何可能。 – TarasB 2010-12-18 19:23:44