更新时间:2023-02-03 16:45:28
请参阅下面的链接.可能会对您有帮助.
http://beyondrelational.com/modules/2/blogs/28/posts/10441/passing-a-data-table-to-a-sql-server-2005-stored-procedure.aspx [使用SQLServer Management将数据从数据表复制到SQLServer数据库对象和SqlBulkCopy [ ^ ]
将数组或DataTable传递到存储过程中 [ ^ ]
Hi,
See the below link. It might be help you.
http://beyondrelational.com/modules/2/blogs/28/posts/10441/passing-a-data-table-to-a-sql-server-2005-stored-procedure.aspx[^]
Copy Data from a DataTable to a SQLServer Database using SQLServer Management Objects and SqlBulkCopy[^]
Passing an array or DataTable into a stored procedure[^]
这些链接可能会对您有所帮助.
将数据表发送到存储过程 [ ^ ]
将数据表传递到SQL Server中的存储过程2008 [ ^ ]
http://weblogs.asp.net/jgalloway/archive/2007/02/16/passing-lists-to-sql-server-2005-with-xml-parameters.aspx [
Hi,
these links may help you..
Sending a DataTable to a Stored Procedure[^]
Passing a datatable to a Stored Procedure in SQL Server 2008[^]
http://weblogs.asp.net/jgalloway/archive/2007/02/16/passing-lists-to-sql-server-2005-with-xml-parameters.aspx[^]
And use MERGE to update the EMP table inside the stored procedure...
Thank you
是的,您可以将数据表传递给SP,但是首先您需要在SQL Server中创建用户定义的表类型,其结构与要传递的数据表相同.例如:
yes u can pass datatable to SP, but first u need to create a user-defined table type in SQL server, having same structure as datatable to be passed. For eg:
CREATE TYPE TypeName AS TABLE
(
col1 int,
col2 varchar(50)
)
然后在SP参数中,使用类型"TypeName".
如果您使用C#,则在将数据表传递给SP时,请使用SqlDbType.Structured.
then in SP parameter, use type "TypeName".
If u r using C#, while passing datatable to SP, use SqlDbType.Structured.