当前位置:编程学习 > C#/ASP.NET >>

it is no longer usable和字符串格式不正确 有代码


#region
private int SaveBaseObject()
        {                        
            /*-----------------增加对象基本信息SQL语句----------------------*/
            if (CheckBaseData(this) != 0) return -2;
            SqlBase sb = new SqlBase("CostObjectBaseUpdate");
            sb.AddParms(":dep_id",System.Data.OracleClient.OracleType.Int32,this.DepId.ToString(),1);
            sb.AddParms(":Id",System.Data.OracleClient.OracleType.Int32,this.ID.ToString(),1);
            sb.AddParms(":cd",System.Data.OracleClient.OracleType.VarChar,this.CD,0);
            sb.AddParms(":nm",System.Data.OracleClient.OracleType.VarChar,this.Name,0);
            sb.AddParms(":describe",System.Data.OracleClient.OracleType.VarChar,this.Describe,0);
            sb.AddParms(":account_method",System.Data.OracleClient.OracleType.Char,this.AccountMethod,0);
            sb.AddParms(":otype",System.Data.OracleClient.OracleType.VarChar,this.OType,0);    
            sb.AddParms(":used",System.Data.OracleClient.OracleType.Char,this.Used,0);
//            sb.AddParms(":account_method",System.Data.OracleClient.OracleType.Char,this.AccountMethod,0);
            sb.AddParms(":dataflag",System.Data.OracleClient.OracleType.Int32,this.DataFlag.ToString(),1);
            myDb.AddNoQuerySQL(sb);

            /*-------------------删除对象已存在的类型---------------------*/
            sb = new SqlBase("CostObjectsBaseAdelete");
            sb.AddParms(":dep_id",System.Data.OracleClient.OracleType.Int32,this.DepId.ToString(),1);
            sb.AddParms(":id",System.Data.OracleClient.OracleType.Int32,this.ID.ToString(),1);
            myDb.AddNoQuerySQL(sb);

            
            /*------------------增加对象类型SQL语句------------------------*/
            for (int i=0;i<objectList.Count;i++)
            {
                sb = new SqlBase("CostObjectsBaseinsert");
                sb.AddParms(":dep_id",System.Data.OracleClient.OracleType.Int32,this.DepId.ToString(),1);
                sb.AddParms(":Id",System.Data.OracleClient.OracleType.Int32,this.ID.ToString(),1);
                sb.AddParms(":mat_tec_equ_id",System.Data.OracleClient.OracleType.Int32,objectList[i].ToString(),1);
                sb.AddParms(":used",System.Data.OracleClient.OracleType.Char,"Y",0);
                myDb.AddNoQuerySQL(sb);
            }
            
            /*-----------------删除该对象的结构的SQL------------------------*/

            sb = new SqlBase("CostStrucObjectdelete");
            sb.AddParms(":object_id",System.Data.OracleClient.OracleType.Int32,this.ID.ToString(),1);
            myDb.AddNoQuerySQL(sb);

            /*--------------------增加对象结构的SQL-------------------------*/
            for (int i=0;i<this.CostBaseItemCollection.Count;i++)
            {                
                if (this.CostBaseItemCollection[i].CostBaseResCollection.Count<=0)
                {
                    sb = new SqlBase("CostStrucBaseinsert");
                    sb.AddParms(":dep_id",System.Data.OracleClient.OracleType.Int32,this.DepId.ToString(),1);
                    sb.AddParms(":object_id",System.Data.OracleClient.OracleType.Int32,this.ID.ToString(),1);
                    sb.AddParms(":item_id",System.Data.OracleClient.OracleType.Int32,this.CostBaseItemCollection[i].ID.ToString(),1);
                    sb.AddParms(":res_id",System.Data.OracleClient.OracleType.Int32,"0",1);
                    sb.AddParms(":com_type",System.Data.OracleClient.OracleType.Int32,"0",0);
                    sb.AddParms(":Res_ration",System.Data.OracleClient.OracleType.Int32,"0",1);
                    sb.AddParms(":Unit_id",System.Data.OracleClient.OracleType.Int32,"0",1);
                    sb.AddParms(":Mhration_id",System.Data.OracleClient.OracleType.Int32,"0",1);
                    sb.AddParms(":Com_flag",System.Data.OracleClient.OracleType.Int32,"0",0);
                    sb.AddParms(":Up_flag",System.Data.OracleClient.OracleType.Int32,"0",0);
                    myDb.AddNoQuerySQL(sb);
                }
                else
                {
                    for (int j=0;j<this.CostBaseItemCollection[i].CostBaseResCollection.Count;j++)
                    {
                        CostBaseRes cbr = this.CostBaseItemCollection[i].CostBaseResCollection[j];
                        sb = new SqlBase("CostStrucBaseinsert");
                        sb.AddParms(":dep_id",System.Data.OracleClient.OracleType.Int32,this.DepId.ToString(),1);
                        sb.AddParms(":object_id",System.Data.OracleClient.OracleType.Int32,this.ID.ToString(),1);
                        sb.AddParms(":item_id",System.Data.OracleClient.OracleType.Int32,this.CostBaseItemCollection[i].ID.ToString(),1);
                        sb.AddParms(":res_id",System.Data.OracleClient.OracleType.Int32,cbr.ID.ToString(),1);
                        sb.AddParms(":com_type",System.Data.OracleClient.OracleType.Int32,cbr.CostBaseStruc.ComType,0);
                        sb.AddParms(":Res_ration",System.Data.OracleClient.OracleType.Number,cbr.CostBaseStruc.ResRation.ToString(),1);
                        sb.AddParms(":Unit_id",System.Data.OracleClient.OracleType.Int32,cbr.CostBaseStruc.UnitId.ToString(),1);
                        sb.AddParms(":Mhration_id",System.Data.OracleClient.OracleType.Int32,cbr.CostBaseStruc.MhrationId.ToString(),1);
                        sb.AddParms(":Com_flag",System.Data.OracleClient.OracleType.Int32,cbr.CostBaseStruc.ComFlag,0);
                        sb.AddParms(":Up_flag",System.Data.OracleClient.OracleType.Int32,cbr.CostBaseStruc.UpFlag,0);
                        myDb.AddNoQuerySQL(sb);
                    }
                }

            }

            try
            {
                myDb.oraExecuteListNoQuerys();                
                return 0;
            }
            catch (DBException de)
            {
                dbErrorCode = de.DbCode;
                dbErrorMessage = de.DbDescribe;                
                return -1;
            }
        }
#endregion

i=3时报RT错误,前三次都没有问题。 --------------------编程问答-------------------- ....哪行报错?
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,