It seems all I can find online are examples of table-valued parameters that require using a stored procedure. I recall doing this in the past without the stored procedure. Is that possible?
This code keeps throwing an error about the type not being specified.
SqlCommand cmd = new SqlCommand(@"
UPDATE t1
SET t1.ScheduledStartUTC = t2.ScheduledStartUTC
FROM ScheduleTickets AS t1
INNER JOIN @SetScheduledStart AS t2 ON t1.ScheduleId = t2.ScheduleId AND t1.PatchSessionId = t2.PatchSessionId
", c);
cmd.Parameters.Add("@SetScheduledStart", SqlDbType.Structured).Value = SetScheduleTicketsDateDT;
cmd.ExecuteNonQuery();
Here you can find how to use it without stored procedure: Passing a Table-Valued Parameter to a Parameterized SQL Statement
Basically, it requires you to:
CREATE TYPE dbo.tvpUpdateScheduledStart AS TABLE (ScheduleId int, PatchSessionId int)
on the server beforehand.TypeName
property of a SqlParameter
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With