Most efficient way of writing multi-select data to a SQL Server backend

130 views Asked by At

I've got a multi-select listbox in an ASP.Net front end using C#. I want to store my data to a SQL Server table.

Do I parse out the data in the code-behind and send the data by looping through an INSERT INTO statement from C#? Or is it more efficient to send a comma-delimited string to the SQL Server, use a table-valued function and then insert the data into the table on that end?

If it's the former, can anyone provide sample code if my multi-select field is called "MatchGender", I'm using a UserID and the table it's being inserted into is called tblMatches? I'm not sure of the C# code necessary to loop through all selected values in a multi-select listbox.

0

There are 0 answers