I need to send list and add my project but this is not working. I don't understand this station
This is error message:
System.InvalidCastException: parameter value of`List ' 1 could not be converted to Int32.'
InvalidCastException: must be implemented by the IConvertible object.
This is my code in sql part:
ServiceAw.AddParameter("@CustID", SqlDbType.Int, value.CustomerIDS)
.
.
string cmd = @"SELECT Name,SurName from WebUsers,";
cmd += @" (select Email from WebUsers as WUS where WUS.UserID = FixID) as UserMail,Fixed";
cmd += @" where S.Ref <> 0 ";
if (value.CustomerIDS != null)
{
int i = 0;
cmd += @" and ST.Ref NOT IN (";
foreach (int item in value.CustomerIDS)
{
if (i == 0) { cmd += $"'{item}'"; } else { cmd += $",'{item}'"; }
i++;
}
cmd += @" )";
}
This is my class:
public class SpecialInput
{
public int CustomID { get; set; }
public int UserID { get; set; }
public List<int> CustomerIDS{ get; set; }
}