Manage/ManageClass.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
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;
using System.Data.SqlClient;
public partial class Manage_ManageClass : System.Web.UI.Page
{
SqlConnection con = DB.getcon();
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.GridBind();
TextBox1.Text ="";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text =="")
this.Label1.Visible=true;
else
{
string mclass = this.TextBox1.Text.Trim();
con.Open();
SqlCommand cmd = new SqlCommand("insert into Categories (CatName) values('" + mclass + "')", con);
try { cmd.ExecuteNonQuery(); }
catch (Exception e1)
{
Response.Write(e1.Message);
}
con.Close();
this.GridBind();
this.TextBox1.Text = "";
}
}
public void GridBind()
{
SqlDataAdapter sda = new SqlDataAdapter("select * from Categories", con);
sda.Fill(ds, "mclass");
this.GridView1.DataSource = ds.Tables["mclass"].DefaultView;
this.GridView1.DataBind();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
this.GridView1.EditIndex = -1;
this.GridBind();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
后面还有 31 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
