This code is not only edits cells value its edits and duplicate also
I cannot find problem please help me
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 AND ArtNumber = @an ", 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();
}
}