Challenging issue you have encountered already ?
This is my challenge.
I have the query as follows - MSSQL Server 2017 calling from my C# application.
SQL
update slides set isBorrowed=0, updated_by='Daniel'
where id in (1,2,3);
C# code to achieve above
'Update Slides SET isBorrowed=1,updated_by=@update_by WHERE id IN (@ids)'
string updateDonorQuery = "UPDATE slides " +
"SET isBorrowed=1,updated_by=@updated_by WHERE id IN (@ids)";
command.CommandText = updateDonorQuery;
command.CommandType = CommandType.Text;
command.Parameters.AddWithValue("@ids",list_ids.Split(',').Select(int.Parse).toList());
command.Parameters.AddWithValue("@updated_by", "Full name
Now The error is saying : "Exception on my command not expecting to receive list"
Then , i have changed to a string like this:
string list_ids = "1,2,3";
command.Parameters.AddWithValue("@ids",list_ids);
command.Parameters.AddWithValue("@updated_by", "Full name")
Agin code throw exception that complainant i have passed in nvarchar values instead of int. I guess interested the code as '1,2,3' when getting ids.
Guys i need a breakthrough , i hate loops.