DataSet ds = new DataSet();
        string strCom = " select * from  FSFZ where FREC is null";
        ds =User_system.lws.query_database(strCom, "FSFZ");
        int a =int.Parse ( ds.Tables[0].Rows.Count.ToString());        if (ds != null)
        {
            ds.Tables["FSFZ"].Rows.Add();
            ds.Tables[0].Rows[0]["FREC"]=System.Guid.NewGuid().ToString();
            ds.Tables[0].Rows[0]["FYEAR"] = this.DropDownList1.SelectedValue.ToString();
            ds.Tables[0].Rows[0]["FMONTH"] = this.DropDownList2.SelectedValue.ToString();
            ds.Tables[0].Rows[0]["ACODE"] = this.txt地区代码.Text.ToString();
            ds.Tables[0].Rows[0]["ANAME"] = this.txt地区名称.Text.ToString();
            ds.Tables[0].Rows[0]["ALEVEL"] = this.txt地区级别.Text.ToString();
            ds.Tables[0].Rows[0]["ICODE"] = this.txt病虫代码.Text.ToString();
            ds.Tables[0].Rows[0]["INAME"] = this.txt病虫名称.Text.ToString();
            ds.Tables[0].Rows[0]["TCODE"] = this.txt寄主代码.Text.ToString();
            ds.Tables[0].Rows[0]["TNAME"] = this.txt寄主名称.Text.ToString();
            ds.Tables[0].Rows[0]["IAGE"] = txt世代.Text.ToString();
            ds.Tables[0].Rows[0]["TAREA"] = txt寄主面积.Text.ToString();
            ds.Tables[0].Rows[0]["YAREA"] = txt应施调查监测面积.Text.ToString();
            ds.Tables[0].Rows[0]["JCAREA"] = txt监测面积.Text.ToString();
            ds.Tables[0].Rows[0]["DCDATE"] = txt调查时间.Text.ToString();
            ds.Tables[0].Rows[0]["FBAREA"] = txt分布面积.Text.ToString();
            ds.Tables[0].Rows[0]["DCGAREA"] = txt低虫感面积.Text.ToString();
            ds.Tables[0].Rows[0]["LJFSHJ"] = txt累计发生合计.Text.ToString();
            ds.Tables[0].Rows[0]["LJFSQD"] = txt累计发生轻度.Text.ToString();
            ds.Tables[0].Rows[0]["LJFSZD"] = txt累计发生中度.Text.ToString();
            ds.Tables[0].Rows[0]["LJFSDD"] = txt累计发生重度.Text.ToString();
            ds.Tables[0].Rows[0]["FSL"] = txt发生率.Text.ToString();
            ds.Tables[0].Rows[0]["FSHJ"] = txt发生合计.Text.ToString();
            ds.Tables[0].Rows[0]["FSQD"] = txt发生轻度.Text.ToString();
            ds.Tables[0].Rows[0]["FSZD"] = txt发生中度.Text.ToString();
            ds.Tables[0].Rows[0]["FSDD"] = txt发生重度.Text.ToString();
            ds.Tables[0].Rows[0]["TBCXFS"] = txt同病虫新发生.Text.ToString();
            ds.Tables[0].Rows[0]["CMGZ"] = txt虫密或感指.Text.ToString();
            ds.Tables[0].Rows[0]["FZSJ"] = txt防治时间.Text.ToString();
            ds.Tables[0].Rows[0]["FZMJHJ"] = txt防治作业面积合计.Text.ToString();
            ds.Tables[0].Rows[0]["SFMJHJ"] = txt生防面积合计.Text.ToString();
            ds.Tables[0].Rows[0]["ZJ"] = txt真菌.Text.ToString();
            ds.Tables[0].Rows[0]["XJ"] = txt细菌.Text.ToString();
            ds.Tables[0].Rows[0]["BD"] = TxT病毒.Text.ToString();
            ds.Tables[0].Rows[0]["FL"] = txt蜂类.Text.ToString();
            ds.Tables[0].Rows[0]["LL"] = txt鸟类.Text.ToString();
            ds.Tables[0].Rows[0]["SFQT"] = txt生防其它.Text.ToString();
            ds.Tables[0].Rows[0]["FS"] = txt仿生.Text.ToString();
            ds.Tables[0].Rows[0]["HF"] = txt化防.Text.ToString();
            ds.Tables[0].Rows[0]["RG"] = txt人工.Text.ToString();
            ds.Tables[0].Rows[0]["FZQT"] = txt防治其它.Text.ToString();
            ds.Tables[0].Rows[0]["FZZYMJHJ"] = txt防治作业面积合计.Text.ToString();
            ds.Tables[0].Rows[0]["SFZYMJHJ"] = txt生防作业面积合计.Text.ToString();
            ds.Tables[0].Rows[0]["ZJZYMJ"] = txt真菌作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["XJZYMJ"] = txt细菌作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["BDZYMJ"] = txt病毒作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["FLZYMJ"] = txt蜂类作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["LLZYMJ"] = txt鸟类作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["SFQTZYMJ"] = txt生防其它作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["FSZYMJ"] = txt仿生作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["HFZYMJ"] = txt化防作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["RGZYMJ"] = txt人工作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["FZQTZYMJ"] = txt防治其它作业面积.Text.ToString();
            ds.Tables[0].Rows[0]["FZL"] = txt防治率.Text.ToString();
            ds.Tables[0].Rows[0]["YFMJ"] = txt预防面积.Text.ToString();
            ds.Tables[0].Rows[0]["FFMJ"] = txt飞防面积.Text.ToString();
            ds.Tables[0].Rows[0]["TBCXFZ"] = txt同病虫新防治.Text.ToString();
            ds.Tables[0].Rows[0]["ZJL"] = txt真菌量.Text.ToString();
            ds.Tables[0].Rows[0]["XJL"] = txt细菌量.Text.ToString();
            ds.Tables[0].Rows[0]["BDL"] = txt病毒量.Text.ToString();
            ds.Tables[0].Rows[0]["FLL"] = txt蜂类量.Text.ToString();
            ds.Tables[0].Rows[0]["NLL"] = this.txt鸟类量.Text.ToString();
            ds.Tables[0].Rows[0]["FSZJYL"] = txt仿生制剂用量.Text.ToString();
            ds.Tables[0].Rows[0]["YJLL"] = txt有机磷量.Text.ToString();
            ds.Tables[0].Rows[0]["JZLL"] = txt菊脂类量.Text.ToString();
            ds.Tables[0].Rows[0]["YJL"] = txt烟剂量.Text.ToString();
            ds.Tables[0].Rows[0]["QTL"] = txt其它量.Text.ToString();
            ds.Tables[0].Rows[0]["FZFY"] = txt防治费用.Text.ToString();
            ds.Tables[0].Rows[0]["CZMJ"] = txt成灾面积.Text.ToString();
            ds.Tables[0].Rows[0]["CZL"] = txt成灾率.Text.ToString();
            ds.Tables[0].Rows[0]["SSZS"] = txt死树株数.Text.ToString();
            if (User_system.lws.save_database(ds, "FSFZ") > 0)
            {
                Response.Write("<script>alert('添加成功!');window.opener.location.replace('PecordDisp_J.aspx');window.close();</script>");
        }

解决方案 »

  1.   

    ds.Tables[0].Rows[0]["FREC"]=System.Guid.NewGuid().ToString(); 
                ds.Tables[0].Rows[0]["FYEAR"] = this.DropDownList1.SelectedValue.ToString(); 
                ds.Tables[0].Rows[0]["FMONTH"] = this.DropDownList2.SelectedValue.ToString(); 
                ds.Tables[0].Rows[0]["ACODE"] = this.txt地区代码.Text.ToString(); 
                ds.Tables[0].Rows[0]["ANAME"] = this.txt地区名称.Text.ToString(); 
                ds.Tables[0].Rows[0]["ALEVEL"] = this.txt地区级别.Text.ToString(); 
                ds.Tables[0].Rows[0]["ICODE"] = this.txt病虫代码.Text.ToString(); 
                ds.Tables[0].Rows[0]["INAME"] = this.txt病虫名称.Text.ToString(); 
                ds.Tables[0].Rows[0]["TCODE"] = this.txt寄主代码.Text.ToString(); 
                ds.Tables[0].Rows[0]["TNAME"] = this.txt寄主名称.Text.ToString(); 
                ds.Tables[0].Rows[0]["IAGE"] = txt世代.Text.ToString(); 
                ds.Tables[0].Rows[0]["TAREA"] = txt寄主面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["YAREA"] = txt应施调查监测面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["JCAREA"] = txt监测面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["DCDATE"] = txt调查时间.Text.ToString(); 
                ds.Tables[0].Rows[0]["FBAREA"] = txt分布面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["DCGAREA"] = txt低虫感面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["LJFSHJ"] = txt累计发生合计.Text.ToString(); 
                ds.Tables[0].Rows[0]["LJFSQD"] = txt累计发生轻度.Text.ToString(); 
                ds.Tables[0].Rows[0]["LJFSZD"] = txt累计发生中度.Text.ToString(); 
                ds.Tables[0].Rows[0]["LJFSDD"] = txt累计发生重度.Text.ToString(); 
                ds.Tables[0].Rows[0]["FSL"] = txt发生率.Text.ToString(); 
                ds.Tables[0].Rows[0]["FSHJ"] = txt发生合计.Text.ToString(); 
                ds.Tables[0].Rows[0]["FSQD"] = txt发生轻度.Text.ToString(); 
                ds.Tables[0].Rows[0]["FSZD"] = txt发生中度.Text.ToString(); 
                ds.Tables[0].Rows[0]["FSDD"] = txt发生重度.Text.ToString(); 
                ds.Tables[0].Rows[0]["TBCXFS"] = txt同病虫新发生.Text.ToString(); 
                ds.Tables[0].Rows[0]["CMGZ"] = txt虫密或感指.Text.ToString(); 
                ds.Tables[0].Rows[0]["FZSJ"] = txt防治时间.Text.ToString(); 
                ds.Tables[0].Rows[0]["FZMJHJ"] = txt防治作业面积合计.Text.ToString(); 
                ds.Tables[0].Rows[0]["SFMJHJ"] = txt生防面积合计.Text.ToString(); 
                ds.Tables[0].Rows[0]["ZJ"] = txt真菌.Text.ToString(); 
                ds.Tables[0].Rows[0]["XJ"] = txt细菌.Text.ToString(); 
                ds.Tables[0].Rows[0]["BD"] = TxT病毒.Text.ToString(); 
                ds.Tables[0].Rows[0]["FL"] = txt蜂类.Text.ToString(); 
                ds.Tables[0].Rows[0]["LL"] = txt鸟类.Text.ToString(); 
                ds.Tables[0].Rows[0]["SFQT"] = txt生防其它.Text.ToString(); 
                ds.Tables[0].Rows[0]["FS"] = txt仿生.Text.ToString(); 
                ds.Tables[0].Rows[0]["HF"] = txt化防.Text.ToString(); 
                ds.Tables[0].Rows[0]["RG"] = txt人工.Text.ToString(); 
                ds.Tables[0].Rows[0]["FZQT"] = txt防治其它.Text.ToString(); 
                ds.Tables[0].Rows[0]["FZZYMJHJ"] = txt防治作业面积合计.Text.ToString(); 
                ds.Tables[0].Rows[0]["SFZYMJHJ"] = txt生防作业面积合计.Text.ToString(); 
                ds.Tables[0].Rows[0]["ZJZYMJ"] = txt真菌作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["XJZYMJ"] = txt细菌作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["BDZYMJ"] = txt病毒作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["FLZYMJ"] = txt蜂类作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["LLZYMJ"] = txt鸟类作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["SFQTZYMJ"] = txt生防其它作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["FSZYMJ"] = txt仿生作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["HFZYMJ"] = txt化防作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["RGZYMJ"] = txt人工作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["FZQTZYMJ"] = txt防治其它作业面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["FZL"] = txt防治率.Text.ToString(); 
                ds.Tables[0].Rows[0]["YFMJ"] = txt预防面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["FFMJ"] = txt飞防面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["TBCXFZ"] = txt同病虫新防治.Text.ToString(); 
                ds.Tables[0].Rows[0]["ZJL"] = txt真菌量.Text.ToString(); 
                ds.Tables[0].Rows[0]["XJL"] = txt细菌量.Text.ToString(); 
                ds.Tables[0].Rows[0]["BDL"] = txt病毒量.Text.ToString(); 
                ds.Tables[0].Rows[0]["FLL"] = txt蜂类量.Text.ToString(); 
                ds.Tables[0].Rows[0]["NLL"] = this.txt鸟类量.Text.ToString(); 
                ds.Tables[0].Rows[0]["FSZJYL"] = txt仿生制剂用量.Text.ToString(); 
                ds.Tables[0].Rows[0]["YJLL"] = txt有机磷量.Text.ToString(); 
                ds.Tables[0].Rows[0]["JZLL"] = txt菊脂类量.Text.ToString(); 
                ds.Tables[0].Rows[0]["YJL"] = txt烟剂量.Text.ToString(); 
                ds.Tables[0].Rows[0]["QTL"] = txt其它量.Text.ToString(); 
                ds.Tables[0].Rows[0]["FZFY"] = txt防治费用.Text.ToString(); 
                ds.Tables[0].Rows[0]["CZMJ"] = txt成灾面积.Text.ToString(); 
                ds.Tables[0].Rows[0]["CZL"] = txt成灾率.Text.ToString(); 
                ds.Tables[0].Rows[0]["SSZS"] = txt死树株数.Text.ToString(); 
    这里有个字段是不能为空的,你没给值?
      

  2.   

    谢谢楼上的
    问题我找到了是我的webservice的方法问题