这是我用来交作业的程序.虽然不是自己写的.传上来再说了.
等我自己的可以用了.再传...
package jettang
import java.lang.*
import java.awt.*
import java.awt.event.*
import javax.swing.*
import java.sql.*
//////////////////////////////////////////////
//主类
public class STU {
public STU() {
try {
jbInit()
} catch (Exception ex) {
ex.printStackTrace()
}
}
public static void main(String args[]) {
new Frm_Main()
}
private void jbInit() throws Exception {
}
}
//主框架,数据库
class Frm_Main implements ActionListener { //throws IOException
public static final int EXIT_ON_CLOSE = 0
public Jframe frame
public Container c
public JMenuBar menuBar
public JMenu mainMenu1
public JMenu mainMenu2
public JMenu mainMenu3
public JMenuItem subMenu1[] = new JMenuItem[5]
public JMenuItem subMenu2[] = new JMenuItem[7]
public JMenuItem subMenu3[] = new JMenuItem[2]
JButton toolBarButton[] = new JButton[8]
public JToolBar toolBar
//////////////////////////////////////////////
String strTip[] = {"姓名查询...", "添加信息...",
"删除...", "修改...", "修改确认...",
"添加确认...", "删除确认...", "关于产品信息:)"}
//////////////////////////////////////////////
// String id = new String()
String name = new String()
String sex = new String()
String age = new String()
String classid = new String()
String department = new String()
String call = new String()
//////////////////////////////////////////////
Connection con
ResultSet rs
Statement st
// ResultSetmetaData rsmd
// Vector columnHeads=new Vector()
// Vector rows = new Vector()
// Vector currentRow=new Vector()
///////////////////////////////////////////////
public JLabel classidL = new JLabel("班级")
public JLabel nameL = new JLabel("姓名")
public JLabel sexL = new JLabel("性别")
public JLabel ageL = new JLabel("年龄")
public JLabel departmentL = new JLabel("单位")
public JLabel callL = new JLabel("电话")
public JLabel tittleLabel = new JLabel()
//////////////////////////////////////////////
public JTextField classidT = new JTextField()
public JTextField nameT = new JTextField()
public JTextField sexT = new JTextField()
public JTextField ageT = new JTextField()
public JTextField departmentT = new JTextField()
public JTextField callT = new JTextField()
public Jtextarea textT = new Jtextarea()
//////////////////////////////////////////////
//////////////////////////////////////////////
public Frm_Main() {
/////////////////////////////////////////////////
frame = new Jframe("学籍管理系统V1.0")
c = frame.getContentPane()
c.setLayout(null)
menuBar = new JMenuBar()
toolBar = new JToolBar()
toolBar.setFloatable(false)
frame.setJMenuBar(menuBar)
frame.setResizable(false)
////////////////////////////////////////////////
mainMenu1 = new JMenu("管理")
String str1[] = {"添加", "删除", "查询", " ", "关闭"}
for (int i = 0i <5i++) {
if (i == 3) {
mainMenu1.addSeparator()
} else {
subMenu1[i] = new JMenuItem(str1[i])
subMenu1[i].addActionListener(this)
mainMenu1.add(subMenu1[i])
}
}
menuBar.add(mainMenu1)
/////////////////////////////////////////////////
mainMenu2 = new JMenu("操作")
String str2[] = {"查询", "添加", "删除", "修改",
"提交修改", "提交添加", "提交删除"}
for (int i = 0i <7i++) {
subMenu2[i] = new JMenuItem(str2[i])
subMenu2[i].addActionListener(this)
mainMenu2.add(subMenu2[i])
}
menuBar.add(mainMenu2)
/////////////////////////////////////////////////
mainMenu3 = new JMenu("集体查询")
String str3[] = {"按班级...", "按单位..."}
for (int i = 0i <2i++) {
subMenu3[i] = new JMenuItem(str3[i])
subMenu3[i].addActionListener(this)
mainMenu3.add(subMenu3[i])
}
menuBar.add(mainMenu3)
////////////////////////////////////////////////
String strToolBar[] = {"查询", "添加", "删除", "修改", "提交修改",
"提交添加", "提交删除", "关于"}
for (int i = 0i <8i++) {
toolBarButton[i] = new JButton(strToolBar[i])
toolBarButton[i].setToolTipText(strTip[i])
toolBarButton[i].addActionListener(this)
toolBar.add(toolBarButton[i])
}
toolBar.setLocation(0, 0)
toolBar.setSize(400, 30)
c.add(toolBar)
////////////////////////////////////////////////
classidL.setLocation(35, 40)
classidL.setSize(40, 20)
//classidL.setFont(new Font("",Font.BOLD,12))
c.add(classidL)
classidT.setLocation(90, 40)
classidT.setSize(200, 20)
//classidT.setEnabled(false)
c.add(classidT)
nameL.setLocation(35, 70)
nameL.setSize(40, 20)
c.add(nameL)
nameT.setLocation(90, 70)
nameT.setSize(200, 20)
c.add(nameT)
sexL.setLocation(35, 100)
sexL.setSize(40, 20)
c.add(sexL)
sexT.setLocation(90, 100)
sexT.setSize(200, 20)
c.add(sexT)
ageL.setLocation(35, 130)
ageL.setSize(40, 20)
c.add(ageL)
ageT.setLocation(90, 130)
ageT.setSize(200, 20)
c.add(ageT)
departmentL.setLocation(35, 160)
departmentL.setSize(40, 20)
c.add(departmentL)
departmentT.setLocation(90, 160)
departmentT.setSize(200, 20)
c.add(departmentT)
callL.setLocation(35, 190)
callL.setSize(40, 20)
c.add(callL)
callT.setLocation(90, 190)
callT.setSize(200, 20)
c.add(callT)
/////////////////////////////////////////////////
tittleLabel.setText("----------集体查询结果--------")
tittleLabel.setSize(300, 20)
tittleLabel.setLocation(10, 210)
c.add(tittleLabel)
////////////////////////////////////////////
textT.setSize(400, 300)
textT.setLocation(10, 240)
c.add(textT, 14)
///////////////////////////////////////////////
frame.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE)
frame.setSize(500, 650)
frame.setLocation(200, 200)
frame.setVisible(true)
conDB()
}
//以上是框架设计
//JDBC
public void conDB() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
} catch (ClassNotFoundException e) {
JOptionPane.showMessageDialog(null, "数据库错误")
}
try {
con = DriverManager.getConnection("jdbc:odbc:jettang", "sa", "")
st = con.createStatement()
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "数据库连接失败")
}
}
//关闭连接
public void closeDB() {
try {
st.close()
con.close()
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "数据库关闭失败")
}
}
//事件响应
public void actionPerformed(ActionEvent e) {
//////////////////////////////////////////////
if (e.getSource() == toolBarButton[7]) {
JOptionPane.showMessageDialog(null, "当前版本1.0,designed by qyq &wxm")
}
/////////////////////////////////////////////查询(按姓名)
if (e.getSource() == subMenu2[0] || e.getSource() == toolBarButton[0] ||
e.getSource() == subMenu1[2]) {
String idid = JOptionPane.showInputDialog("请输入学生姓名")
if (idid.trim() != "") {
String strSQL = "select * from stuinfo where name ='" + idid +
"'"
try {
rs = st.executeQuery(strSQL)
int count = 0
while (rs.next()) {
classid = rs.getString("classid")
name = rs.getString("name")
department = rs.getString("department")
sex = rs.getString("sex")
age = rs.getString("age")
call = rs.getString("call")
++count
}
if (count == 0) {
JOptionPane.showMessageDialog(null, "无此信息")
} else {
classidT.setText(classid)
nameT.setText(name)
sexT.setText(sex)
ageT.setText(age)
callT.setText(call)
departmentT.setText(department)
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "查询失败")
}
}
}
/////////////////////////////////////////////关闭
if (e.getSource() == subMenu1[4]) {
frame.dispose()
closeDB()
}
/////////////////////////////////////////////添加
if (e.getSource() == subMenu1[0] || e.getSource() == subMenu2[1] ||
e.getSource() == toolBarButton[1]) {
JOptionPane.showMessageDialog(null, "请输入你添加的信息再点击提交添加键")
classidT.setEnabled(true)
classidT.setText("")
nameT.setText("")
sexT.setText("")
ageT.setText("")
callT.setText("")
departmentT.setText("")
}
/////////////////////////////////////////////提交添加
if (e.getSource() == toolBarButton[5] || e.getSource() == subMenu2[5]) {
if ((classidT.getText().trim()).equals("") ||
(nameT.getText().trim()).equals("") ||
(sexT.getText().trim()).equals("") ||
(ageT.getText().trim()).equals("") ||
(callT.getText().trim()).equals("") ||
(departmentT.getText().trim()).equals("")) {
JOptionPane.showMessageDialog(null, "请先点击添加键")
} else {
classid = classidT.getText()
name = nameT.getText()
sex = sexT.getText()
age = ageT.getText()
call = callT.getText()
department = departmentT.getText()
String strSQL =
"insert into stuinfo(classid,name,sex,age,call,department) values('" +
classid + "','" +
name + "','" + sex + "','" + age + "','" + call + "','" +
department + "')"
try {
st.executeUpdate(strSQL)
} catch (Exception exx) {
JOptionPane.showMessageDialog(null, "添加失败")
return
}
JOptionPane.showMessageDialog(null, "添加成功")
classidT.setText("")
nameT.setText("")
sexT.setText("")
ageT.setText("")
callT.setText("")
departmentT.setText("")
}
}
////////////////////////////////////////////提交修改
if (e.getSource() == subMenu2[4] || e.getSource() == toolBarButton[4]) {
if ((classidT.getText().trim()).equals("") ||
(nameT.getText().trim()).equals("") ||
(sexT.getText().trim()).equals("")
|| (ageT.getText().trim()).equals("") ||
(callT.getText().trim()).equals("") ||
(departmentT.getText().trim()).equals("")) {
JOptionPane.showMessageDialog(null, "请先点击修改键")
return
} else {
classid = classidT.getText()
name = nameT.getText()
sex = sexT.getText()
age = ageT.getText()
call = callT.getText()
department = departmentT.getText()
String strSQL = "update stuinfo set classid='" + classid +
"',sex='" + sex + "',age='" + age + "',call='" +
call + "',department='" + department + "'" +
"where name='" + name + "'"
try {
st.executeUpdate(strSQL)
} catch (Exception exx) {
JOptionPane.showMessageDialog(null, "修改失败")
return
}
JOptionPane.showMessageDialog(null, "修改成功")
classidT.setText("")
nameT.setText("")
sexT.setText("")
ageT.setText("")
callT.setText("")
departmentT.setText("")
}
}
///////////////////////////////////////////////修改
if (e.getSource() == subMenu2[3] || e.getSource() == toolBarButton[3]) {
String idid = JOptionPane.showInputDialog
("请输入你要修改的学生姓名后点击提交修改键确认")
if (idid.trim() != "") {
String strSQL = "select * from stuinfo where name ='" + idid +
"'"
try {
rs = st.executeQuery(strSQL)
int count = 0
while (rs.next()) {
classid = rs.getString("classid")
name = rs.getString("name")
department = rs.getString("department")
sex = rs.getString("sex")
age = rs.getString("age")
call = rs.getString("call")
++count
}
if (count == 0) {
JOptionPane.showMessageDialog(null, "无此信息")
} else {
classidT.setText(classid)
nameT.setText(name)
sexT.setText(sex)
ageT.setText(age)
callT.setText(call)
departmentT.setText(department)
classidT.setEnabled(false)
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "修改失败")
}
}
}
/////////////////////////////////////////////////删除
if (e.getSource() == subMenu2[2] || e.getSource() == toolBarButton[2] ||
e.getSource() == subMenu1[1]) {
String idDel = JOptionPane.showInputDialog
("请输入要删除的学生姓名后点击提交删除键确认")
if (idDel.trim() != "") {
String strSQL = "select * from stuinfo where name ='" + idDel +
"'"
try {
rs = st.executeQuery(strSQL)
int count = 0
while (rs.next()) {
classid = rs.getString("classid")
name = rs.getString("name")
department = rs.getString("department")
sex = rs.getString("sex")
age = rs.getString("age")
call = rs.getString("call")
++count
}
if (count == 0) {
JOptionPane.showMessageDialog(null, "无此信息")
} else {
classidT.setText(classid)
nameT.setText(name)
sexT.setText(sex)
ageT.setText(age)
callT.setText(call)
departmentT.setText(department)
classidT.setEnabled(false)
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "删除失败")
}
}
}
//////////////////////////////////////////////////提交删除
if (e.getSource() == toolBarButton[6] ||
e.getSource() == subMenu2[6]) {
if ((classidT.getText().trim()).equals("") ||
(nameT.getText().trim()).equals("") ||
(sexT.getText().trim()).equals("") ||
(ageT.getText().trim()).equals("") ||
(callT.getText().trim()).equals("") ||
(departmentT.getText().trim()).equals("")) {
JOptionPane.showMessageDialog(null, "请先点击删除键")
return
} else {
name = nameT.getText()
String strSQL = "delete from stuinfo where name='" + name +
"'"
try {
st.executeUpdate(strSQL)
} catch (Exception exx) {
JOptionPane.showMessageDialog(null, "删除失败")
return
}
JOptionPane.showMessageDialog(null, "删除成功")
classidT.setText("")
nameT.setText("")
sexT.setText("")
ageT.setText("")
callT.setText("")
departmentT.setText("")
}
}
//////////////////////////////////////////////集体查询(按班级)
if (e.getSource() == subMenu3[0]) {
classidT.setText("")
nameT.setText("")
sexT.setText("")
ageT.setText("")
callT.setText("")
departmentT.setText("")
if ((classidT.getText().trim()).equals("")) {
String idclass = JOptionPane.showInputDialog("请输入班级")
String strSQL = "select * from stuinfo where classid='" +
idclass +
"'"
try {
rs = st.executeQuery(strSQL)
displayres(rs)
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "查询失败")
}
} else {
String idclass = classidT.getText()
String strSQL = "select * from stuinfo where classid='" +
idclass +
"'"
try {
rs = st.executeQuery(strSQL)
displayres(rs)
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "查询失败")
}
}
}
////////////////////////////按单位
if (e.getSource() == subMenu3[1]) {
classidT.setText("")
nameT.setText("")
sexT.setText("")
ageT.setText("")
callT.setText("")
departmentT.setText("")
if ((departmentT.getText().trim()).equals("")) {
String idclass = JOptionPane.showInputDialog("请输入单位")
String strSQL = "select * from stuinfo where department='" +
idclass +
"'"
try {
rs = st.executeQuery(strSQL)
displayres(rs)
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "查询失败")
}
} else {
String idclass = departmentT.getText()
String strSQL = "select * from stuinfo where department='" +
idclass +
"'"
try {
rs = st.executeQuery(strSQL)
displayres(rs)
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "查询失败")
}
}
}
}
public void displayres(ResultSet rs1) throws SQLException {
//定位到达第一条记录
boolean moreRecords = rs1.next()
//如果没有记录,则提示一条消息
if (!moreRecords) {
JOptionPane.showMessageDialog(null, "无此记录")
return
}
try {
//获取数据
getNextRow(rs1)
//刷新Table
c.validate()
}
catch (SQLException sqlex) {
sqlex.printStackTrace()
}
}
public void getNextRow(ResultSet rs2) throws
SQLException {
int count = 1
while (rs2.next()) {
name = " 姓名:" + rs2.getString(1)
age = " 年龄:" + rs2.getString(2) + " 单位:"
department = rs2.getString(3) + "n"
textT.append(count + "." + name + age + department)
count++
}
}
}
.系统分析
2.1系统基本情况描述
随着社会进步,社会对人才素质要求越来越高,相应的,需要学校的工作越来越周到、全面、先进、高效。这不仅使教务管理的日常工作日趋复杂繁重,而且,对它提出了更高的要求。 教务管理系统强化了教务管理的职能,涵盖了教师管理、学生管理、课表系统、分班系统等等主要功能,对教务管理工作进行了提炼和概括, 使教务管理工作日益规范化、制度化和科学化。教务管理系统的使用,大大减少了管理者的手工劳动,是学校管理的得力助手。
(1)主要功能
档案系统
成绩系统
新生系统
系统设置管理
软件用户管理
(2) 功能概述 1、档案系统主要功能为学籍管理,学籍管理是教务行政管理工作的重要内容,提供各种查询功能以便及时了解学生的信息 2、成绩系统 主要包括学生在校期间各科学习成绩的登录,统计处理,各种成绩表册及成绩报告单打印和保存,提供各种查询功能以便及时了解各科教学情况和各班学习质量。 3、新生系统 包括分配班级,和学号生成;编班是按照性别、生源地等情况,并按照某些给定的原则把新生分配到各个平行班级,并允许人工调整。原始数据来自学招生办公室 4、系统设置管理 5、软件用户管理(3) 系统特点 1、 全面构建数字化校园,实现校园无纸办公 2、 具有一定的可移植性,可针对不同的用户需求定制系统部分功能 3、 用户界面友好
2.2 可行性分析
在现行系统初步调查的基础上就可以提出新系统目标,即新系统建立后所要求达到的运行指标,这是系统开发和评价的依据。新系统目标应充分体现学校的战略目标、发展方向和基本特点,直接为学校管理服务,同时,新系统目标应该和现行系统的各项基本功能密切相关,并且可以分期分批实现。需要指出的是,新系统目标不可能在总体规划阶段就提得非常具体,它还将在开发过程中逐步明确和定量化。新系统目标的提法不尽相同,例如:
提高工作效率和减轻劳动强度;
提高信息处理速度和准确性;
提供新的处理功能和决策信息;
为教学、科研提供更方便的服务项目。
新系统的目标确定后,就可以从以下三方面对能否实现新系统目标进行可行性分析:
(1)技术可行性
根据新系统目标来衡量所需的技术是否具备,一般可从硬件、软件的性能要求、环境条件、技术人员水平和数量等方面去考虑和分析,其中开发人员的技术力量应首先考虑能力与水平,并考虑近期内可以培养和发展的技术人员。
(2)经济可行性
估算新系统的开发费用和今后的运行、维护费用,估计新系统将获得的效益,并将费用与效益进行比较,看是否有利。
开发、运行和维护费用主要包括:
购买和安装设备的费用:计算机硬件、系统软件、 机房、电源、空调等;
软件开发费用:若由本单位的技术人员开发,则该项费用可以计入下面的人员费用一项;
人员费用:系统开发人员、操作人员和维护人员的工资、培训费用等;由于本项目的特殊性该部分费用可节省。
PB9里面提供了SQLSERVER的接口。
打开PB9,看上面菜单的DATAbase那一项,打开,选择SQL SERVER,新建,把服务名,登录用户名和密码都填写上,就可以配置成功了。
如果你的SQL SERVER 2000设置的是WINDOWS用户登录,那么就要用ODBC连接来配置一个数据源,然后在PB的DATAbase选项下选DATAbase,ODBC一项来配置。
如何配置ODBC,请看下面。
设置--控制面板--ODBC数据源--默认打开是用户DSN--增加--在弹出的新建数据源左边选择最底下的SQL Server--单击完成--数据源名称任意--描述不用填--服务名如果是本地输入:. 或是127.0.0.1--下一步--如果你安装SQL的时候是混合验证方式那么直接下一步,如果是SQL验证方式就选择使用用户和密码的SQL验证,然后将用户名中的ADMINISTRATOR删除改为SA,密码就是SA的口令,再下一步--这里能够看到MASTER数据库一般就没有问题了,选择你要操作的数据库--下一步--完成。在完成窗口中可以测试一下数据源,如果测试成功,SQL应该没有问题。
必须的:
基本语法,定义,赋值,输入输出,循环,判断,基本运算
文件操作:增删改
数据结构:指针,链表,结构体
排序:至少是冒泡吧
基本结构:
1)输入部分,输入数据+逻辑判断+文件处理
(scanf,gets,if-else,FILE)
2)编辑部分,文件处理+输出数据+输入数据
(scanf,gets,printf,FILE)
3)查询部分, 文件处理+排序处理+逻辑判断+输入数据+输出数据
(...)
4)可选的,数据库底层,就是提供增删改查的接口函数的一组函数。
(...)
教务管理信息系统的源程序属于应用软件。
教学管理系统是学校信息化的重要组成部分,是学校教学运行的重要基石,由此得知教务管理系统程序属于应用软件。
教务管理系统(又称教学管理信息服务平台,简称教务系统)是大学教学管理信息化的一个综合平台。
以上就是关于急求(教务管理系统 pb9.0 源代码)毕业设计用 高分!全部的内容,如果了解更多相关内容,可以关注醉学网,你们的支持是我们更新的动力!