抓取QueryString上字串(參數)
//假設URL參數字串為
//index.aspx?id=aaa&email=hh@gmail.com&id2=bbb&email=cc@hotmail.com
//index.aspx?id=aaa&email=hh@gmail.com&id2=bbb&email=cc@hotmail.com
for (int i = 0; i < Page.Request.QueryString.Count; i++) { if (Page.Request.QueryString.AllKeys.GetValue(i).ToString().StartsWith("id")) { rowid = Page.Request.QueryString.AllKeys.GetValue(i).ToString().Replace("id", ""); if (strParameter == "") { if (!string.IsNullOrEmpty(rowid)) strIndex += rowid; strParameter = " ( id=" + string.Format("@id{0} ", rowid) + " and email=" + string.Format("@email{0} ", rowid) + " ) "; } else { if (!string.IsNullOrEmpty(rowid)) strIndex += "," + rowid; strParameter += " OR ( id=" + string.Format("@id{0} ", rowid) + " and email=" + string.Format("@email{0} ", rowid) + " ) "; } } }
留言
張貼留言
您好,我是 Lawrence,這裡是我的開發筆記的網誌,如果你對我的文章有任何疑問或者有錯誤的話,歡迎留言讓我知道。