请问这代码怎么滴?下面错误看不懂using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Chp4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void Form1_Load(object sender, EventArgs e)
        {
            Load();
        }
        private void Load()
        {
            string contxt = "server=.;database=MySchool;uid=sa;pwd=";
            SqlConnection con = new SqlConnection(contxt);
            con.Open();
            string sql = "select StudentNo,StudentName,Gender,g.GradeName  from Student s inner join Grade g on g.GradeId= s.GradeId";
            SqlCommand com = new SqlCommand(sql, con);
            SqlDataReader read = com.ExecuteReader();
            while (read.Read())
            {
                string stuNo = read["StudentNo"].ToString();
                string stuName = read["StudentName"].ToString();
                string stuGender = read["Gndeer"].ToString();
                string stuGrade = read["GradeName"].ToString();
                ListViewItem item = new ListViewItem(stuNo);
                item.SubItems.Add(stuName);
                item.SubItems.Add(stuGender);
                item.SubItems.Add(stuGrade);
                listView1.Items.Add(item);
            }
            read.Close();
        }
    }
}
警告 1 “Chp4.Form1.Load()”隐藏了继承的成员“System.Windows.Forms.Form.Load”。如果是有意隐藏,请使用关键字 new。 F:\寒假\Chp4\Chp4\Form1.cs 25 22 Chp4错误 2 “Load”是一个“方法组”,无法为它赋值 F:\寒假\Chp4\Chp4\Form1.Designer.cs 118 13 Chp4

解决方案 »

  1.   

    已经说的很清楚了,把load换个名字或者在前面加个new关键字
      

  2.   

    用new修饰,或者换一个名字就,和父类的名字重复了,又不是虚函数
      

  3.   

    Load换一个名字,换成cLoad,你的窗体Form1是继承Form基类的,Form基类中也有一个名字叫Load方法,你这个Load方法和他的基类Form中的Load的名字相同,当然冲突啦。这是C#多态里面的隐藏。。
    简单点说,就是 你取了两个相同的名字,编译器哪里知道用哪一个撒。所以你要覆盖掉基类中的Load方法,就要加个new。。建议换名字,不加new
      

  4.   

      private void Load()=======》
    换个函数名字
    private void Form1_Load(object sender, EventArgs e)
    {
      LoadDataFromDB();
    } private void LoadDataFromDB()
    {
       //
    }
      

  5.   

    load  重了  换个 名字么  不就好了
      

  6.   

    楼上的都是正解, Load函数换个名字, 
    楼主的MySchool项目我做过, 是书上的贯穿项目
      

  7.   

    给Load改一下就可以了 改成小写  
      

  8.   

      楼主,你啥名字不好取,怎么写个方法也叫Load咯。。