首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

异常6嵌入的语句不能是声明或标记语句string,怎么处理

2013-03-21 
错误6嵌入的语句不能是声明或标记语句string,怎么办? protected void Button1_Click(object sender, Event

错误6嵌入的语句不能是声明或标记语句string,怎么办?
 protected void Button1_Click(object sender, EventArgs e)
    {
        if (RadioButtonList1.SelectedValue != "")
        {
            if(Request.Cookies["ip"]!=null)
                string newip=Request.Cookies["ip"].Value;
            if(newip==Request.UserHostAddress)
                Response.Write("<script>alert('你已经投票!')</script>");
            return;
    

            int selectvalue = Convert.ToInt32(RadioButtonList1.SelectedValue);

            switch (selectvalue)
            {
                case 1:
                    read2write(1);
                    break;
                case 2:
                    read2write(2);
                    break;
                case 3:
                    read2write(3);
                    break;
                case 4:
                    read2write(4);
                    break;
            }
        }
} button
[解决办法]


string newip = string.Empty;
 if(Request.Cookies["ip"]!=null)
       newip=Request.Cookies["ip"].Value;

热点排行