發表文章

Unable to start debugging on the web server.Could not start ASP.NET debugging

圖片
ASP.NET 4.5 has not been registered on the Web server. You need to manually configure your Web server  for  ASP.NET 4.5  in   order  for   your site to run correctly. 當我作業系統換到Windows10,在我打開.NET 4.5發生的這兩個錯誤 我的作法是 1.打開控制台 2.選取程式集 3.選取程式與功能 4.你會看到一個開啟或關閉Windows功能的選項 5.點進去之後,找到IIS相關的(Internet Information Services) 6.展開之後看到World Wide Web服務展開他 7.找到ASP.NET4.7選擇他 8.按下確認,完成設定 如果你跟我的情況一樣,這樣或許可以解決問題,請參考:)

table 外來鍵限制

1.Create Table tableName( columName datatype not null Primary key, id int not null Primary key, gender nvarchar(50) ) 2.隨時使用某資料庫 Use DBname Go 3.增加FOREIGN KEY 限制 Alter table 資料表名字 add constraints 外來鍵的表_外來鍵_FK Foreign key (外來鍵名) references 要參考的主鍵表名(主鍵名) 4.如果要加之前外來鍵表不符合這個限制 需要先改之後才能加 例如說Person表有GenderId=99 這時候要加限制 但Gender表的id只有1,2 所以不符合 不能加 要把99改掉 5.外來鍵限制的意義 保持資料完整性 避免出現不符合常理的資料

c# out 輸出參數修飾子 example

    class Program     {         static void Main(string[] args)         {            //1.傳值 2.傳址 3.輸出參數 4.陣列參數            //out 3.輸出參數            //1.傳回多個值            //2.呼叫的地方和被呼叫的方法都要加上out關鍵字            //3.在含有out關鍵字參數的方法裡面,一定要將所有的out參數賦予值             int i = 4;             int j = 2;             int sum;             int multiple;             int division;             int subtraction;             para(i, j, out sum, out multiple, out division, out subtraction);             Console.WriteLine(sum);         ...

switch multi case

最近才知道switch可以用在多個case string name="zoe"; switch(name) {    case "zoe":    case "Rose":    case "Sue": Console.WriteLine("hello " + name ); break;   }

XML Comment

https://docs.microsoft.com/zh-tw/dotnet/csharp/codedoc

陣列 Array

陣列為一個同資料型態的集合,由0開始。 像是字串/整數 string[] strArr={"a","b"}; int[] intArr= new int[2]; 優點: 整個陣列都是為同一型態,當指定錯誤的型態會不能編譯。 缺點: 陣列的大小在初始化過後無法擴張,           而且只能用索引來設置與取得陣列中的值 如strArr[1]           可能會導致索引超過拋出錯誤的現象(寫for迴圈沒設定好超過)

out c# 多個參數

out是將記憶體位置傳過去, 看到以下例子,我們可以發現我們在main方法裡面,並沒有指派 i和j的值,但是呼叫了ccc方法,把i和j的變數在記憶體存放的位置傳過去,該方法把該記憶體位置存放改成rr和ee ,所以當我們print時,發現可以得到值   class Program     {         static void Main(string[] args)         {             string i,j;             ccc(out i,out j);             Console.WriteLine(j);  //輸出rr             Console.WriteLine(i);  //輸出ee                       Console.ReadLine();         }         public static void ccc(out string i,out string j){             i = "rr";             j = "ee";         }     }