return && continue用法小結

 
        private static void GetMISCPBM(DataTable dtJLD)
        {
            if (dtJLD == null || dtJLD.Rows.Count == 0)
                return;  //跳出此函數
            foreach(DataRow dr in dtJLD.Rows)
            {
                string strERP_WL_BM = dr["ERP_WL_BM"] == DBNull.Value ?  "" : dr["ERP_WL_BM"].ToString();
                if (strERP_WL_BM == "")
                    continue; //下面的代碼不執行了,重新下一個循環
                if (strERP_WL_BM.Length == 16)
                {
                    strERP_WL_BM = strERP_WL_BM.Substring(8, strERP_WL_BM.Length - 8);
                }
                else
                {
                    continue;
                }
                string strSql = "select xsmis_bm  from zd_sap_bmdz where bmlb='01'  and sap_key1='"+strERP_WL_BM+"' ";
                DataTable dtMISCPBM = Sybase.SlnDataAccess.GetDataTable(strSql);
                if (dtMISCPBM == null || dtMISCPBM.Rows.Count == 0)
                    continue;
                if (dtMISCPBM.Rows[0][0] != DBNull.Value)
                {
                    dr["ITEMNUM"] = dtMISCPBM.Rows[0][0].ToString();
                }
                
            }
        }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章