大家帮我看一下,为什么会遇到这样的错误呢?
原来以为是fillyear函数里面的东西有错误,但是把函数里面的东西全注释掉了还是提示:
<1> 错误 1 应输入 } .
<2> 错误 2 应输入类型、命名空间定义或文件尾.
原代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class renqiang_3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
private void FillYear()
{
//ListItem Year=new ListItem();
//now=DateTime.Now.Year;
//for(int i=1949;i <=now;i++)
//{ Year.Text=i.ToString() + "年 ";
// Year.Value=i.ToString();
// DropDownListYear.Items.Add(Year);
}
}
}
------解决方案--------------------private void FillYear()
{
//ListItem Year=new ListItem();
//now=DateTime.Now.Year;
//for(int i=1949;i <=now;i++)
//{ Year.Text=i.ToString() + "年 ";
// Year.Value=i.ToString();
// DropDownListYear.Items.Add(Year);
}
去掉还会有错吗?
------解决方案--------------------using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class renqiang_3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
FillYear();
}
private void FillYear()
{
//ListItem Year=new ListItem();
//now=DateTime.Now.Year;
//for(int i=1949;i <=now;i++)
//{ Year.Text=i.ToString() + "年 ";
// Year.Value=i.ToString();
// DropDownListYear.Items.Add(Year);
}
}
------解决方案--------------------private void FillYear()
{
//ListItem Year=new ListItem();
//now=DateTime.Now.Year;
//for(int i=1949;i <=now;i++)
//{ Year.Text=i.ToString() + "年 ";