DEV Community

Discussion on: How to Send a Complex Type List of Objects to SQL Server

Collapse
 
edwinoaragon profile image
Edwin Aragon

Thank you for your reply.

The first thing you mention in your reply is worth adding to the post, I'll update it right away.

About point 2, I think the same, it's better to take advantage of strongly typed things when possible since you can detect bugs earlier in your development process.

I didn't know about point 3, super useful information thank you for bringing in it up!

I think we are on the same page though since in the next line I'm assigning the SQL type explicitly through:

movieAssignmentsParameter.SqlDbType = SqlDbType.Structured;

So I think it does the same as your line, please correct me if I'm wrong.

Collapse
 
peledzohar profile image
Zohar Peled

I'm glad I could help.
About AddWithValue - yes, you can use it like you've done.
Personally, I find using Add more readable - but that's probably a personal preference.
Cheers!