📄 frmnewstudent.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Students1
{
using StudentLibrary.Business;
public partial class frmNewStudent : Form
{
public frmNewStudent()
{
InitializeComponent();
}
private void GetClass()
{
Classs classs = new Classs();
DataSet dataSet = new DataSet();
try
{
dataSet = classs.SelectClass(
-1,
"");
}
catch (Exception e)
{
MessageBox.Show(e.Message);
this.Close();
return;
}
this.cboClass.DisplayMember = "ClassName";
this.cboClass.ValueMember = "ClassId";
this.cboClass.DataSource = dataSet.Tables[0];
}
private void frmNewStudent_Load(object sender, EventArgs e)
{
GetClass();
}
private void button1_Click(object sender, EventArgs e)
{
Students students = new Students();
students.InsertStudent(
this.txtBrithday.Value,
this.cboGender.SelectedIndex,
Convert.ToInt32(this.cboClass.SelectedValue),
0,
this.txtStudentNo.Text,
this.txtName.Text,
this.txtRemark.Text);
MessageBox.Show("建立成功。");
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -