日期:2014-05-17  浏览次数:20481 次

varchar转成datetime
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
The statement has been terminated.这个是错误
以下是代码
  MssqlFields fields1 = new MssqlFields();
            fields1.Add("ActionType", "UpdateDate");
            fields1.Add("BU", this.ddlBU.SelectedValue.ToString());
            fields1.Add("Payee", this.ddlPayeer.SelectedValue.ToString());
            fields1.Add("Supplier", this.ddlPayeer.SelectedValue.ToString());
            fields1.Add("PartNo", txtPartNo.Text.Trim());
            fields1.Add("VendorPartNo", txtVendorPartNo.Text.Trim());
            fields1.Add("DescriptionCN", txtDescriptionCn.Text.Trim());
            fields1.Add("DescriptionEN", txtDescriptionEN.Text.Trim());
            fields1.Add("PalletSize", txtPalletSize.Text.Trim());
            fields1.Add("PartNoProperty", ddlPartNoProperty.SelectedValue.ToString());
            fields1.Add("PartNoType", ddlPartNoType.SelectedValue.ToString());
            fields1.Add("PackageType", ddlPackType.SelectedValue.ToString());
            if (ckbQICFlag.Checked == true)
            {
                fields1.Add("IQCFlag", "Y");

            }
            else
            {
                fields1.Add("IQCFlag", "N");

            }
            try
            {
                decimal ShippingRage = Convert.ToDecimal(txtShippingRage.Text.Trim());
                int CtnByPlt = Convert.ToInt32(txtCtnByPlt.Text.Trim());
                int QtyByCtn = Convert.ToInt32(txtQtyBtCn.Text.Trim());
                int MinPackingQty = Convert.ToInt32(txtMinPackingQty.Text.Trim());
            }
            catch (Exception)