.net课程设计(19)
发布时间:2021-06-06
发布时间:2021-06-06
conn.Close(); GridViewBind(); } }
protected void imgBtnReset_Click(object sender, ImageClickEventArgs e) {
txtCourceID.Text = ""; txtCourceName.Text = ""; txtTime.Text = ""; txtAddress.Text = "";
txtCourceInformation.Text = ""; } }
adminStudentAdd界面如下:
添加后台代码(在设计里面的空白处双击或者在职员管理器中的Login.aspx.cs中添加)如下:
public partial class adminStudentAdd : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) { }
protected void imgBtnAdd_Click(object sender, ImageClickEventArgs e) {
SqlConnection SqlCommand
insertCmd
conn =
new
=
SqlCommand("insert
new into
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); Student(stuID,stuPwd,stuName,stuDepart,stuGrade,stuClass)
values(@stuID,@stuPwd,@stuName,@stuDepart,@stuGrade,@stuClass)", conn); insertCmd.Parameters.Add("@stuID", SqlDbType.VarChar, 15);