I have a listbox with items that are a concatenation of two columns (Game_ID+"- "+Name) in a different listbox. So each listbox item looks like:
1- Game#1
2- Game#2
...
...
10- Game#10
...
100- Game#100
I need to know how to make the parameter only the game_ID portion of the list item. So basically I need just the portion to the left of the hyphen.
string newPGame = "INSERT INTO admin.promo_games(promo_ID, Game_ID) VALUES(@PID, @GameID)"
SqlCommand insGames = new SqlCommand(newPGame, misc);
insGames.Parameters.AddWithValue("@PID", txtID.Text);
insGames.Parameters.AddWithValue("@GameID", lstSelGames.SelectedValue);
foreach (string item in lstSelGames.Items)
{
insGames.ExecuteNonQuery();
}
SqlCommandisIDisposableso should be in ausingblock.