當網址列沒有參數"id"時:
Request.QueryString["ID"] == null
Convert.ToString(Request.QueryString["ID"]) == null
注意這樣會出錯:
Request.QueryString["ID"].ToString();
當網址列有參數"id",但沒有賦值的時候:
Request.QueryString["ID"] == ""
Request.QueryString["ID"] == String.Empty
Convert.ToString(Request.QueryString["ID"]) == ""
Convert.ToString(Request.QueryString["ID"]) == String.Empty
同時判斷二個條件的時候:
if ("" + Request.QueryString["ID"] == "") {...}
if (("" + Request.QueryString["ID"]).Length == 0) {...}
出處:近水大樓BLOG