All pastes #387351 Raw Edit

reznor

public text v1 · immutable
·published 2007-03-09 08:46 UTC
rendered paste body
        public bool updateProduct(int ProductId, string BrandName, string ProductName, double SRP, double GrossWeight, double NetWeight, double ShelfWidth, double ShelfHeight, double ShelfDepth, string LastUpdated)
        {
            try
            {
                int RowCount;
                SqlConnection MyConnection = new SqlConnection(GlobalConstants.DbConnectionString);
                SqlCommand MyCommand = new SqlCommand("Exec UpdateProduct @ProductId, @BrandName, @ProductName, @SRP, @GrossWeight, @NetWeight, @ShelfWidth, @ShelfHeight, @ShelfDepth", MyConnection);
                MyCommand.Parameters.Add("@ProductId", SqlDbType.Int).Value = ProductId;
                MyCommand.Parameters.Add("@BrandName", SqlDbType.VarChar).Value = BrandName;
                MyCommand.Parameters.Add("@ProductName", SqlDbType.VarChar).Value = ProductName;
                MyCommand.Parameters.Add("@SRP", SqlDbType.Decimal).Value = SRP;
                MyCommand.Parameters.Add("@GrossWeight", SqlDbType.Decimal).Value = GrossWeight;
                MyCommand.Parameters.Add("@NetWeight", SqlDbType.Decimal).Value = NetWeight;
                MyCommand.Parameters.Add("@ShelfWidth", SqlDbType.Decimal).Value = ShelfWidth;
                MyCommand.Parameters.Add("@ShelfHeight", SqlDbType.Decimal).Value = ShelfHeight;
                MyCommand.Parameters.Add("@ShelfDepth", SqlDbType.Decimal).Value = ShelfDepth;
                MyCommand.Parameters.Add(new SqlParameter("@LastUpdated",SqlDbType.Timestamp)).Value = System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary.Parse(LastUpdated).Value;


                MyConnection.Open();
                RowCount = MyCommand.ExecuteNonQuery();
                MyConnection.Close();
                if (RowCount == 0) return false;
                else return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }