int count = ds.Tables["[Sheet1$]"].Rows.Count;
                    StudentVO sVO = new StudentVO();
                    string[] nations =                     for (int i = 0; i < count; i++)
                    {
                        //try
                        //{
                        //    sVO.StudentID = Convert.ToInt32(ds.Tables["[Sheet1$]"].Rows[i]["id"].ToString());
                        //    sVO.StudentNuber = ds.Tables["[Sheet1$]"].Rows[i]["nuber"].ToString();
                        //    sVO.StudentKsh = ds.Tables["[Sheet1$]"].Rows[i]["ksh"].ToString();
                        //    sVO.StudentNO = ds.Tables["[Sheet1$]"].Rows[i]["no"].ToString();
                        //    sVO.StudentAdmission = ds.Tables["[Sheet1$]"].Rows[i]["admission"].ToString();
                        //    sVO.StudentName = ds.Tables["[Sheet1$]"].Rows[i]["name"].ToString();
                        //    sVO.StudentSex = ds.Tables["[Sheet1$]"].Rows[i]["sex"].ToString();
                        //    sVO.StudentBirthday = Convert.ToDateTime(ds.Tables["[Sheet1$]"].Rows[i]["birthday"].ToString());
                        //    sVO.StudentNation = ds.Tables["[Sheet1$]"].Rows[i]["nation"].ToString();
                        //    sVO.StudentAcademiccode = ds.Tables["[Sheet1$]"].Rows[i]["academiccode"].ToString();
                        //    sVO.StudentYears = ds.Tables["[Sheet1$]"].Rows[i]["years"].ToString();
                        //    sVO.StudentImage = ds.Tables["[Sheet1$]"].Rows[i]["image"].ToString();
                        //    sVO.StudentSystem = ds.Tables["[Sheet1$]"].Rows[i]["system"].ToString();
                        //    sVO.StudentProfessional = ds.Tables["[Sheet1$]"].Rows[i]["professional"].ToString();
                        //    sVO.StudentAddress = ds.Tables["[Sheet1$]"].Rows[i]["address"].ToString();
                        //    sVO.StudentPhone = ds.Tables["[Sheet1$]"].Rows[i]["phone"].ToString();
                        //    sVO.StudentStatus = Convert.ToInt32(ds.Tables["[Sheet1$]"].Rows[i]["status"].ToString());
                        //    sVO.StudentInformation = ds.Tables["[Sheet1$]"].Rows[i]["information"].ToString();
                        //    sVO.StudentLive = Convert.ToInt3(ds.Tables["[Sheet1$]"].Rows[i]["live"].ToString());
                        //    sVO.StudentCollege = ds.Tables["[Sheet1$]"].Rows[i]["college"].ToString();
                        //}
                        //catch (Exception ex)
                        //{
                        //    this.tsLable.Text = ex.ToString();
                        //    return;
                        //}
                    }提示错误:编译器错误信息: CS1525: 无效的表达式项“for”源错误: 行 67:                     string[] nations = 
行 68: 
行 69:                     for(int i=0; i < count; i++)
行 70:                     {
行 71:                         try
 
我实在是搞不懂怎么错了,请遇到过此问题的朋友帮助下

解决方案 »

  1.   

    string[] nations = for(int i=0; i < count; i++)
    {
    ....
    这段代码的意思是将for的返回值赋值给nations
    C# 会认为for(int i=0; i < count; i++) 是一个表达式 我为你为什么会问这样的问题 而感到疑惑
    难道IDE报的错 你就只看报错行?
      

  2.   


    int count = ds.Tables["[Sheet1$]"].Rows.Count;
                        StudentVO sVO = new StudentVO();
                        string[] nations =                     for (int i = 0; i < count; i++)
                        {
      

  3.   

    string[] nations = for语句?
      

  4.   

    string[] nations =