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

时间:2010-12-18 19:01:38

标签: sql sql-server-2008 enterprise-library enterprise

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

2 个答案:

答案 0 :(得分:0)

我没有尝试这样做但是快速查看了EntLib数据块,我看不到实现这一目标的简单方法。您可以使用SqlClient对象执行此操作,但EntLib不支持将数据作为TVP传递所需的结构化数据类型。

如果保证除了SQL Server后端之外不需要任何其他内容,那么我认为您可以将连接转换为特定于SQLServer的连接,然后使用SqlParameters,但这会在某种程度上破坏使用EntLib的目的。 / p>

答案 1 :(得分:0)

祝你好运...... 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.