为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

C#
WentworthPeach 2017-07-11 10:23:02
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);        }    }      }
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 2256 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信