C# and sql server error

Oct 26 2010 4:08 PM
when im trying to use this code, vs shows me this error:
< Unclosed quotation mark after the character string '@bc'.
Incorrect syntax near '@bc'.>

does anybody have idea where is problem?


     internal static void EditProduct(string txtBarCode, string txtArtNumber, string txtProductName, string txtPrice, string txtComment, decimal NumericUpDown1, string PriceWithOutAWD, string txtSelfPrice) 
{
SqlConnection con = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand("UPDATE Products SET BarCode = @BarCode, ArtNumber = @ArtNumber, ProductName = @ProductName, Price = @Price, SelfPrice = @SelfPrice, PriceWithOutAWD = @PriceWithOutAWD, UnitsInStock = @UnitsInStock, Comment = @Comment WHERE BarCode = '@bc", con);


cmd.Parameters.Add(new SqlParameter("@BarCode", txtBarCode));
cmd.Parameters.Add(new SqlParameter("@ArtNumber", txtArtNumber));
cmd.Parameters.Add(new SqlParameter("@ProductName", txtProductName));
cmd.Parameters.Add(new SqlParameter("@Price", txtPrice));
cmd.Parameters.Add(new SqlParameter("@SelfPrice", txtSelfPrice));
cmd.Parameters.Add(new SqlParameter("@PriceWithOutAWD", PriceWithOutAWD));
cmd.Parameters.Add(new SqlParameter("@UnitsInStock", NumericUpDown1));
cmd.Parameters.Add(new SqlParameter("@Comment", txtComment));
cmd.Parameters.Add(new SqlParameter("@bc", txtBarCode));
//cmd.Parameters.Add(new SqlParameter("@an", txtArtNumber));
try
{
con.Open();
cmd.ExecuteNonQuery();
}
finally
{
con.Close();
}
}


Answers (1)