>Command.CommandText = "INSERT INTO Programs (ProgName, ProgramDescription, " + > "Location, CoordinatorID) VALUES(@Name, @Description, @Location, @ID)\nSELECT @@IDENTITY"; >Command.Parameters.AddWithValue("@Name", this.txtbName.Text); >Command.Parameters.AddWithValue("@Description", this.txtbDescription.Text); >Command.Parameters.AddWithValue("@Location", this.txtbLocation.Text); >Command.Parameters.AddWithValue("@ID", CoID); >>
foreach (ListItem Item in this.lsbEvntTargetPop.Items) { if (Item.Selected) { Command.CommandText += "\nINSERT INTO EventTargets VALUES(@EvID,@EventVal)"; Command.Parameters.AddWithValue("@EventVal", Item.Value); } }but I'm getting an error. How should I change this?