Use an array to fill table with a stored procedure RRS feed

  • Question

  • I have a multi select listbox on a page so users can select multiple names off the list.  I have two tables in SQL Server where I insert data from a form, then take the primary key from that first table and use it for filling in the second table along with the multiple IDs from the listbox.

    This is my parameter here:


    [] AnalystID = lstNewSelectAnalyst.GetSelectedIndices();

    "@AnalystID", AnalystID);

    Unfortunately I don't know the best way to take this array from my listbox (lstNewSelectAnalyst) and insert a new row in my table for each selected index with my SQL stored procedure.  I can get it to work with using only one value like below:

        INSERT INTO JunctPM_Analyst(  

    How do I change this to INSERT a new row in the JunctPM_Analyst table for each new Selected Index from my array?  Is there a good resource out there this?  Even an example would be great as I've been having a hard time figuring this out.


    Friday, March 20, 2009 6:48 PM