I have a table for translators, and each translator is capable of translating from one source language to many target languages. I am creating a Windows form application for such a table, and have tried using a listbox for such an entry, but it gives me the following error
The variable name '@lang_code' has already been declared. Variable names must be unique within a query batch or stored procedure.
Code:
List<String> SelectedItems=new List<String>();
foreach (System.Data.DataRowView s in listBox1.SelectedItems)
{
string select = s.ToString();
SelectedItems.Add(select);
myCmd.Parameters.AddWithValue("@lang_code", select);
}
myCmd? Inside or outside theforeachloop?abcanddef. You only have one parameter (@lang_code), what is your expected value of@lang_code?