• 大小: 2.09MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-06
  • 语言: C#
  • 标签: C#  

资源简介

C#版学生综合信息管理系统,界面看上去挺不错,它可以完成学生个人信息管理、考试管理、作业提交、讨论交流、在线答题、成绩查询等功能,在VS2005下顺利编译,使用MSSQL数据库,运行前请先附加数据库。

资源截图

代码片段和文件信息

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.SqlClient;
//下载自:源码爱好者 http://www.codefans.net
namespace Loginframe
{
    public partial class AddQuestion : Form
    {
        public AddQuestion()
        {
            InitializeComponent();
            
        }

        private void AddQuestion_Load(object sender EventArgs e)
        {
            string sql = “select SubjectName from Subject“;
            try
            {
                SqlCommand command = new SqlCommand(sql DbHelper.connection);
                DbHelper.connection.Open();

                SqlDataReader dataReader = command.ExecuteReader();

                while (dataReader.Read())
                {
                    cboSubject.Items.Add(dataReader[“SubjectName“].ToString());
                }
                dataReader.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
            finally {
                DbHelper.connection.Close();
            }
        }
                
        private void btnAdd_Click(object sender EventArgs e)
        {
            string question = txtQuestion.Text.Trim();
            string optionA = txtAnserA.Text.Trim();
            string optionB = txtAnserB.Text.Trim();
            string optionC = txtAnserC.Text.Trim();
            string optionD = txtAnserD.Text.Trim();
            string subject = cboSubject.Text;
            int subjectId = 0;
            string answer = ““;
            int difficulty = 0;
            if (!ValidateInput())
            {
                MessageBox.Show(“信息填写不完整!“);
            }
            else {
                string sql = string.Format(“select SubjectId from Subject where SubjectName=‘{0}‘“subject);
                try
                {
                    SqlCommand command = new SqlCommand();
                    command.CommandText = sql;
                    command.Connection = DbHelper.connection;
                    DbHelper.connection.Open();
                    
                    //得到科目编号
                    subjectId = (int)command.ExecuteScalar();
                    //SqlDataReader dataReader = command.ExecuteReader();
                    //if(dataReader.Read()){
                    //    subjectId = (int)dataReader[0];
                    //}
                    //dataReader.close();
                    
                    //确定答案
                    if (rdoA.Checked) {
                        answer = “A“;
                    }else if (rdoB.Checked) {
                        answer = “B“;
                    }else if (rdoC.Checked) {
                        answer = “C“;
                    }else{
                        answer = “D“;
                    }


                    //确定难

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

----------- ---------  ---------- -----  ----

             12979519                    120


评论

共有 条评论