Click here to Skip to main content
14,449,862 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi friends ,

I m tried to insert multiple rows at a time. So, i am used DataTable to insert data. But at the runtime , i can't able to insert the records. The follwing exception was thrown. Please any one suggest to me, how to pass the table through datatable.


The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.
Table-valued parameter 1 ("@TypeTravellerDetails"), 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.

Reference link : Sending a DataTable to a Stored Procedure[^]
Posted
Updated 5 days ago
Rate this:
Please Sign up or sign in to vote.

Solution 1

   
v2
Comments
Member 11307706 6-Feb-15 5:18am
   
Hello peter thanks for the answer. Your code is fine for ADO.Net. But , the problem is we should be use Microsoft.Practices.EnterpriseLibrary.Data Database class or Microsoft.Practices.EnterpriseLibrary.Data objects . Is it possible ? Please give me some suggestion.
Rate this:
Please Sign up or sign in to vote.

Solution 2

When using SqlCommandBuilder.DeriveParameters with a user defined table type input parameter stored procedure there is a bug.
SqlCommandBuilder.DeriveParameters will return the user defined table type SqlParameter.TypeName prefaced with the database name.
Example: SqlParameter.TypeName = Sandy.Data.Idar
Set SqlParameter.TypeName to the type name only and this will solve the error.
Example: SqlParameter.TypeName = Data.Idar
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100