To invoke a stored procedure in c# while passing a list as a parameter, you can follow the below code snippet. Here we are making use of SqlClient and adding the list as a SqlParameter of SqlDbType.Structured type.
main.cs936 chars31 lines
In the above example, "dbo.CustomListType" is a user-defined table type created in the database to match the structure of the DataTable tvp. This is necessary because SqlDbType.Structured parameter requires the name of the user-defined table type. Also, make sure to match the parameter name and type as per the stored procedure.
gistlibby LogSnag