Hi I have the below code, which should loop through all values currently in the list box and insert them into two colums, Staff_ID and project_ID.
When making the first loop insert, it works fine and inserts the correct staff id and project ID into the table.
However during the the second loop, it inserts the correct staff_id but does NOT insert the correct project_id. It actually seems to insert the ID of the project_staff table into the project_iD field rather than the value of the item in the listbox.
Any help would be great
for (int i = 0; i < ListBox2.Items.Count; i++)
{
string cmdInsert = "INSERT INTO Staff_Project (Staff_ID, Project_ID) VALUES (@Staff_ID, @Project_ID)";
SqlCommand com = new SqlCommand(cmdInsert, con);
...
Go to the complete details ...