C#报错:事件"System.UI.Control.Load"只能出现在+=的左边

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.Page;

namespace practice1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        private void page_load(object sender, System.EventArgs e)
        {
            SqlConnection myconnection = new SqlConnection("sever=localhost;uid=sa;pwd=sa");
            try
            {
                myconnection.Open();
                Response.Write("数据导入成功!");
            }
            catch
            {
                Response.Write("数据导入失败!");
            }
        }
        override protected void OnInit(System.EventArgs e)
        {
            InitiallizeComponent();
            base.OnInit(e);
        }
        private void InitiallizeComponent()
        {
            this.Load = new System.EventHandler(this.page_load);
        }
    }

     
}

WentworthPeach
浏览 2257回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP