📄 luru.aspx.cs
字号:
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 luru : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
try
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Data source=.;Database=xueji;Integrated Security=SSPI";
conn.Open();
String sql = "insert into student(id,name,sex,adress,birth,sfid,adept,subject,class1,email,tel,beizhu)" + "values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + RadioButtonList1.SelectedValue + "','" + TextBox3.Text + "','" + DropDownList1.SelectedValue + DropDownList2.SelectedValue + DropDownList3.SelectedValue + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox10.Text + "','" + TextBox8.Text + "','" + TextBox12.Text + "')";
SqlCommand comm = new SqlCommand(sql, conn);
int a = comm.ExecuteNonQuery();
if (a!= 0)
Label6.Text = "成功录入";
conn.Close();
}
catch
{
Response.Write("<script>alert('用户已存在!')</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -