問題 :
原因 :
發現DB Table 沒有設定到pk, 因此資料庫加pk後,記得重新把ef edmx重新設置,我是移除有問題的table重新新增
重新建置後就ok嚕
using (ZipFile zips = new ZipFile(FileUpload.Path, Encoding.Default))
在一開始建立物件時,就決定編碼格式。
第二個:檔案內文字出現亂碼
public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{language}/{controller}/{action}/{id}", defaults: new {language="chinese", controller = "Home", action = "Index", id = UrlParameter.Optional } ); } }
[TestInitialize] public void TestInitialize() { //arrange scope = new TransactionScope(); } [TestCleanup] public void TestCleanup() { scope.Dispose(); }
public class XmlHelper { public static TSource TryPareseXml<TSource>(string xmlString) { XmlSerializer serializer = new XmlSerializer(typeof(TSource)); TSource result; //反序列化 using (TextReader reader = new StringReader(xmlString)) { try { result = (TSource)serializer.Deserialize(reader); } catch (Exception) { return default(TSource); ; } return result; } } }