C# ------- 二维表变成一行数据存储,使用后如何分别获取
将一个二维表,使用一行数据表示
在数据库中可以看做
然后实际应用的时候,将字段名为 Ext05 中数据进行拆分获取,
根据对应的规格获取其对应的价格
就可以得到每行数据了
dd
try { List<ITEM.Model.qdCnt4.FourCollsType> mBiaoZhunList = _bllCollType.Get_Ex_FourCollsTypeListByTypeCollName_Like("*", sQiyeGuid, 4010, xbomlist.LianjianMark, 0f);//比对的是 对应手册编号 if (mBiaoZhunList.Count > 0) { for (int i = 0; i <= mBiaoZhunList.Count - 1; i++) { ITEM.Model.qdCnt4.FourCollsType mType = mBiaoZhunList[i]; if (mType.Ext05.IndexOf(xbomlist.LianJianFormat) >= 0) { #region 拆分Ext05 中的规格和单价 string[] s1 = mType.Ext05.Split('|'); for (int j = 0; j <= s1.Length - 1; j++) { string[] s2 = s1[j].Split('~'); if (s2[0] == xbomlist.LianJianFormat) { decimal dPrice = Convert.ToDecimal(s2[1]); xbomlist.LFeePrice = dPrice; xbomlist.LFeeCount = xbomlist.LianJianSum * dPrice; return 1; } } #endregion } } } } catch { }
第一步调用的方法
public List<ITEM.Model.qdCnt4.FourCollsType> Get_Ex_FourCollsTypeListByTypeCollName_Like(string sFilesName, string QiyeGuid, int iTypeID, string sTypeCollName, float _iFlag) { int iFlag = (int)_iFlag; if (AppFourCollsType.get_List_CollsType_Application_CollName(iTypeID, sTypeCollName, iFlag.ToString()) != null) { return AppFourCollsType.get_List_CollsType_Application_CollName_Like(iTypeID, sTypeCollName, iFlag.ToString()); } else { string strsql = " and TypeCollName like '%" + sTypeCollName + "%' and SysTypeID=" + iTypeID + " and IsDelete=0 order by TypeCollMark"; List<ITEM.Model.qdCnt4.FourCollsType> mList = GetListSelFourCollsType3(sFilesName, QiyeGuid, iFlag, strsql); return mList; } }