I have created user defined data type and passing parameter ,how to pass that parameter in code using C# ,i'm facing issue while passing it is getting conversion failed from list to enumerable
eg:database server
ALTER procedure [dbo].[SpUpdateID] @List AS dbo.STATUSID READONLY AS BEGIN SET NOCOUNT ON; Select ID from @List END CREATE TYPE [dbo].[STATUSID] AS TABLE( [ID] [int] NULL ) GO
code :
List<object> idValues = new List<object>(); string filename = exportPath + "Data_" + datetime + ".csv"; SqlCommand cmd = new SqlCommand("SpUpdateID", connect); cmd.CommandType = CommandType.StoredProcedure; SqlParameter valparam = new SqlParameter("@List", idValues); valparam.SqlDbType = SqlDbType.Structured; valparam.TypeName = "dbo.STATUSID"; cmd.ExecuteNonQuery();