程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> 服務器-c# 解壓文件的 解壓之後沒有存進數據庫 沒有看的解壓之後 文件

服務器-c# 解壓文件的 解壓之後沒有存進數據庫 沒有看的解壓之後 文件

編輯:編程綜合問答
c# 解壓文件的 解壓之後沒有存進數據庫 沒有看的解壓之後 文件
   Stream stream = HttpContext.Current.Request.InputStream;
            account = HttpContext.Current.Request.Params["Account"];
            if (account == null || account == "")
            {
                account = "unknown";
            }
            desZipFilePrefix = ServiceHelp.getDesZipFileName(account);
            fileSuffixNme = ".rar";
            //讀取文件流將文件保存到服務器的特定目錄下
            compressFilePath = OperateZipFile.writeCompressFile(stream, desZipFilePrefix + fileSuffixNme);
            if (Directory.Exists(System.Web.HttpContext.Current.Server.MapPath("DesFile")) == false)
            {
                Directory.CreateDirectory(System.Web.HttpContext.Current.Server.MapPath("DesFile"));
            }
            deCompressFilePath = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("DesFile"), desZipFilePrefix);
            OperateZipFile.UnRar(deCompressFilePath, compressFilePath, desZipFilePrefix + fileSuffixNme);

            //解析shapefile文件
            FeatureShapeFileParse featureShapeFileParse = new FeatureShapeFileParse();
            featureShapeFileParse.filePathForShp = featureShapeFileParse.getShpPath(deCompressFilePath);
            featureShapeFileParse.filePathForShx = featureShapeFileParse.getShxPath(deCompressFilePath);
            featureShapeFileParse.filePathForDbf = featureShapeFileParse.getDbfPath(deCompressFilePath);
            List<ShpFileData> shpFileDataList = featureShapeFileParse.readShpFile();
           List<DbfFileData> dbfFileDataList = featureShapeFileParse.readDbfile();

           if (dbfFileDataList == null)
           {
               new Normal_AdminlogsDAL().SaveMapServiceLog(" 解壓失敗,或者文件為空");
               return;
           }

            SurveyFeatureAddRequest surveyFeatureAddRequest = getSurveyFeatureAddRequest(shpFileDataList, dbfFileDataList);

           string featureSql = string.Format(" INSERT INTO [PRO_PollingCheckLog]([P_ProID],[P_UserID],[P_CheckLogName],[P_StartTime],[P_EndTime],[P_Attributes],[P_LayerName],[P_FeatureName],[P_PicURI],[P_MediaURI],[P_Note],[P_StatusID],[P_CreateUserName],[P_CreateTime]) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}',getdate() ) ;", 
                surveyFeatureAddRequest.ProjectID, surveyFeatureAddRequest.SysUserId, surveyFeatureAddRequest.ProjectName, surveyFeatureAddRequest.SurveyTime, surveyFeatureAddRequest.SurveyTime, 
                surveyFeatureAddRequest.Attributes, surveyFeatureAddRequest.LayerName, surveyFeatureAddRequest.FeatureName, surveyFeatureAddRequest.PicURI, surveyFeatureAddRequest.MediaURI, surveyFeatureAddRequest.Note, 
                1, account);

            int exerst = new SurveyFeatureDAL().InsertSurveyFeature(featureSql);
            if (exerst > 0)
            {
                //刪除解壓後的臨時文件
                deleteTempFile();
                //記錄用戶操作日志
                //new Normal_AdminlogsDAL().SaveLog(surveyFeatureAddRequest.SysUserId.ToString(), "項目名稱:" + surveyFeatureAddRequest.ProjectName + ",關聯地物信息已經上傳成功。");
            }
            else {
                new Normal_AdminlogsDAL().SaveMapServiceLog("插入失敗");//Test
 dbfFileDataList 總是等 null   

最佳回答:


你的壓縮文件是什麼類型,單獨執行解壓縮是否正確,或者報什麼錯誤。

u011954277
u011954277
caozhy
u011954277
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved