地址信息分割

        ///////
        string qString = Request.ServerVariables["Query_String"];
        Response.Write(qString);

        string[] q1 = qString.Split('&');
        Response.Write("<BR>");

        ArrayList aa = new ArrayList();
        ArrayList bb = new ArrayList();
        foreach (string qq in q1)
        {
            Response.Write(qq);
            Response.Write("<BR>");
            string[] cc = qq.Split('=');
            if (cc.Length == 2)
            {
                aa.Add(cc[0].ToString());
                bb.Add(cc[1].ToString());
            }
        }
        Response.Write(aa.Count);
        Response.Write(bb.Count);
        Response.Write("<br>");
        int andstr = 0;
        string where = "";
        foreach (string obj in aa)
        {
            if (andstr > 0)
            {
                where = where + " And ";
            }
            Response.Write(obj + "=@" + obj);
            Response.Write("<br>");
            where = where + obj + "=@" + obj;

            andstr = andstr + 1;
        }
        Response.Write(where);
        ///////

posted @ 2011-08-09 15:02  hellowing  阅读(225)  评论(0)    收藏  举报