我傳遞一個DataTable從代碼到存儲過程在這樣表變量。無法訪問存儲過程
DataTable table = CommonFunctions.ToDataTable(request);
object[] spParams = new object[1];
spParams[0] = table;
DbCommand dbCommand =
db.GetStoredProcCommand("OS_UpdateOrgStructureDetails", spParams);
我想在存儲過程中訪問此參數。
CratePROCEDURE OS_UpdateOrgUnits
@table OS_RenameNodeTable READONLY
AS
BEGIN
UPDATE OrgUnit
SET DetailName = ut.NewValue
FROM @table ut
INNER JOIN OrgUnit ou ON ou.OrgUnitID = ut.OrgUnitID
END
但是,當調用存儲過程時,它會引發錯誤。
The incoming tabular data stream (TDS) remote procedure call (RPC) protocol
stream is incorrect. Table-valued parameter 1 ("@table"), row 0, column 0:
Data type 0xF3 (user-defined table type) has a non-zero length database name
specified. Database name is not allowed with a table-valued parameter, only
schema name and type name are valid.
無法解決該錯誤。
這可能有助於http://msdn.microsoft。 com/en-us/library/bb510489(SQL.100).aspx – 2012-03-29 07:49:45