现在有个C#编写的ERP程序 在数据库里取值放到前台 但是现在有一部分客户端显示正确值(2800) 一部分客户端显示错误值(这个值比真实值小,是2241) ,后台代码是一样的,为什么两台机器有这个差异呢
这是什么原因 大家有遇到过吗 ?

解决方案 »

  1.   

                double byzgsl = 0;
                double byzgje = 0;
                //单据和运费以及初始数据继续暂估入库(Inclassify=16或21或41)
                dt = bs.getDatabySQL("Data", "select isnull(sum(sl),0) as sl,isnull(sum(je6),0) as je from Material_ViewStoreHouseIn where (inclassify=15 or inclassify=21 or inclassify=41) and (inventorycoding='" + txtCoding.Text + "') and (date>='" + dpby1.Value.ToString("yyyy-MM-dd") + "') and (date<='" + dp3.Value.ToString("yyyy-MM-dd") + "')and(StoreHouseCoding='" + Convert.ToString(StoreHouse.Tag) + "')and(GoodsPlaceCoding='" + Convert.ToString(GoodsPlace.Tag) + "') and (invoicestate='未到') and (checkflag=1)");
                if (dt.Rows.Count > 0)
                {
                    double sl = Convert.ToDouble(dt.Rows[0]["sl"]);
                    sl = num(sl.ToString("f3"));                byzgsl += sl;
                    byzgje += Convert.ToDouble(dt.Rows[0]["je"]);
                }
                else
                {
                    byzgsl = 0;
                    byzgje = 0;
                }
                //正常入库但是发票没到
                dt = bs.getDatabySQL("Data", "select isnull(sum(sl),0) as sl,isnull(sum(je6),0) as je from Material_ViewStoreHouseIn where  (inventorycoding='" + txtCoding.Text + "') and (invoicestate='未到')  and inclassify=1 and (isnull(hostname,'')='')and(StoreHouseCoding='" + Convert.ToString(StoreHouse.Tag) + "')and(GoodsPlaceCoding='" + Convert.ToString(GoodsPlace.Tag) + "') and date>='" + rq1 + "' and date<='" + rq2 + "'");
                if (dt.Rows.Count > 0)
                {
                    byzgsl += Convert.ToDouble(dt.Rows[0]["sl"]);
                    byzgje += Convert.ToDouble(dt.Rows[0]["je"]);
                }
                else
                {
                    byzgsl = 0;
                    byzgje = 0;
                }
                txtSL4.Text = byzgsl.ToString("0.0000");
                txtJE4.Text = byzgje.ToString("0.00");
      

  2.   

    设置断点跟踪一下SQL语句吧!看看取值的情况。