public static void InsertProduct(ref Products P) { SqlCeCommand com = DBCon.CeCon.CreateCommand(); com.CommandText = "INSERT INTO PRODUCTS (PRODUCT_CODE, PRODUCT_NAME, PRODUCT_IMAGE) VALUES (@PRODUCT_CODE, @PRODUCT_NAME, @PRODUCT_IMAGE);"; com.Parameters.AddWithValue("PRODUCT_CODE", P.PRODUCT_CODE == null ? (object)DBNull.Value : P.PRODUCT_CODE); com.Parameters.AddWithValue("PRODUCT_NAME", P.PRODUCT_NAME == null ? (object)DBNull.Value : P.PRODUCT_NAME); com.Parameters.AddWithValue("PRODUCT_IMAGE", P.PRODUCT_IMAGE == null ? (object)DBNull.Value : P.PRODUCT_IMAGE.ToArrayOfBytes()); com.ExecuteNonQuery(); com.Dispose(); P = ProductsOP.GetProduct(P.PRODUCT_CODE); }