>>>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); >> >> } >> }>>
Command.CommandText += "SET @EvID = @@IDENTITY"; foreach (ListItem Item in this.lsbEvntTargetPop.Items) { if (Item.Selected) { //Command.CommandText += "\nINSERT INTO EventTargets VALUES(@EvID,@EventVal)"; //Command.Parameters.AddWithValue("@EventVal", Item.Value); Command.CommandText += string.Format("\nINSERT INTO EventTargets VALUES(@EvID,'{0}')", Item.Value); } }