资源简介
该学籍管理系统采用C#作为开发平台,数据库采用Access,系统简单实用
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace 学生学籍管理系统
{
public partial class AddClass : Form
{
public AddClass()
{
InitializeComponent();
}
private void button3_Click(object sender EventArgs e)
{
textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = textBox6.Text = ““;
}
private void button2_Click(object sender EventArgs e)
{
DB.cn.Close();
this.Close();
}
private void button1_Click(object sender EventArgs e)
{
string oldconn = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=xsxjdb.mdb“;
OleDbConnection oleDbConnection1 = new OleDbConnection(oldconn);
oleDbConnection1.Close();
oleDbConnection1.Open();
string sql;
OleDbCommand cmd = new OleDbCommand(““ oleDbConnection1);
if (textBox1.Text.Trim() == ““ || textBox2.Text.Trim() == ““ || textBox3.Text.Trim() == ““ || textBox4.Text.Trim() == ““ || textBox5.Text.Trim() == ““ || textBox6.Text.Trim() == ““)
{
MessageBox.Show(“请填写全部信息!“ “提示“);
}
else
{
DB.cn.Close();
DB.cn.Open();
OleDbCommand oldcomm = new OleDbCommand(““ DB.cn);
sql = “select ClassNum from ClassInfo where ClassNum=‘“ + textBox1.Text.Trim() + “‘“;
oldcomm.CommandText = sql;
if (oldcomm.ExecuteScalar() != null)
{
MessageBox.Show(“你输入的班级编号已经存在,请重新输入!“ “错误提示“);
}
else
{
sql = “insert into ClassInfo values (‘“ + textBox1.Text.Trim() + “‘‘“ + textBox2.Text.Trim() + “‘‘“ + textBox3.Text.Trim() + “‘‘“ + textBox4.Text.Trim() + “‘‘“ + textBox5.Text.Trim() + “‘‘“ + textBox6.Text.Trim() +“‘ )“;
oldcomm.CommandText = sql;
oldcomm.ExecuteNonQuery();
MessageBox.Show(“添加成功!“ “提示“);
DB.cn.Close();
}
oleDbConnection1.Close();
}
}
private void AddClass_Load(object sender EventArgs e)
{
DataSet ds = new DataSet();
OleDbDataAdapter adp = new OleDbDataAdapter(““ DB.cn);
adp.SelectCommand.CommandText = “select ClassName from ClassInfo“;
adp.Fill(ds);
textBox1.Focus();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2009-06-01 09:09 C#学籍管理系统
----------- --------- ---------- ----- ----
55117558 175
评论
共有 条评论