基本信息
源码名称:C#学生信息管理系统源代码没有敏感数据(需安装Oracle数据库)
源码大小:8.09M
文件格式:.rar
开发语言:C#
更新时间:2024-11-14
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 1 元 
   源码介绍

C#学生信息管理系统源代码(需安装Oracle数据库)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Diagnostics;
using Microsoft.Win32;
//using Microsoft.Office.Interop.Word;
//using ImageToPdf;
using System.Drawing.Imaging;//图片格式处理
//国腾打印
using System.Drawing.Printing;
//动画
using System.Drawing.Drawing2D;
//using ThoughtWorks.QRCode.Codec;
using System.Threading;
using System.Data.OracleClient;
//引用资源类 
//add manually
using System.Speech.Synthesis;//语音
using System.Timers;
using F_AutoQuery;
namespace F_AutoQuery
{
    public partial class F_AutoQuery : Form
    {
        private Thread trd;
        private System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
        public F_AutoQuery()
        {
            InitializeComponent();
        }
        string ip;
        string pw;
        string fid;
        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void F_AutoQuery_Load(object sender, EventArgs e)
        {
            Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath @"\bak\");
            Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath @"\img\");
            if (!File.Exists(System.Windows.Forms.Application.StartupPath @"\ip.txt"))
            {
                string createText = "" Environment.NewLine;
                File.WriteAllText(System.Windows.Forms.Application.StartupPath @"\ip.txt", createText);
            }
            else
            {
                ip = File.ReadAllText(System.Windows.Forms.Application.StartupPath @"\ip.txt");
            }
            if (!File.Exists(System.Windows.Forms.Application.StartupPath @"\os.dat"))
            {
                string createText = "" Environment.NewLine;
                File.WriteAllText(System.Windows.Forms.Application.StartupPath @"\os.dat", createText);
            }
            else
            {
                pw = File.ReadAllText(System.Windows.Forms.Application.StartupPath @"\os.dat");
            }
            //F_setupOracle Frm = new F_setupOracle();
            FLogin Frm = new FLogin();//登录
            Frm.StartPosition = FormStartPosition.CenterParent;
            Frm.Tag = 1;
            Frm.ShowDialog();//登录
            //dt.Columns.Add("身份证", Type.GetType("System.String"));
            //dt.Columns.Add("查询条件", Type.GetType("System.String"));
            //dataGridView4.DataSource = dt;
            //设置dataGridView1
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            //         dataGridView1.VirtualMode = true;
            dataGridView1.Columns.Insert(0, new DataGridViewCheckBoxColumn());
            dataGridView1.Columns[0].Resizable = DataGridViewTriState.False;
            dataGridView1.Columns[0].Frozen = true;
            dataGridView1.Columns[0].DividerWidth = 1;
            dataGridView1.Columns[0].Width = 30;
            //   dataGridView1.ClearSelection();//清空选择
            //dataGridView1.CurrentCell = null;//清空选择
            // dataGridView1.Rows[0].Selected = false;//清空选择
            //     datagridview 有个属性叫“SelectlionMode”,将其改成 FullRowSelect //清空选择就行了
            foreach (DataGridViewColumn c in dataGridView1.Columns)
                if (c.Index != 0) c.ReadOnly = true;
            //  MyCheckState = new Dictionary<int, bool>();
        }

        //查询
        public void Query()
        {
            string sql ="";
            linkLabel1.Text = "正在查询请稍候...";
            //MessageBox.Show("" hh "");
            // MessageBox.Show("" Query_tmp "");
            //          OracleCommand cmd;
            //         OracleDataAdapter adp;
            //try
            //{
            //    string UserID = File.ReadAllText(@"\\" ip @"\Share\bar\Ur.dat");
            //    string Password = File.ReadAllText(@"\\" ip @"\Share\bar\Ps.dat");
            //    string HOST = File.ReadAllText(@"\\" ip @"\Share\bar\HT.dat");
            //    string PORT = File.ReadAllText(@"\\" ip @"\Share\bar\PT.dat");
            //    string SERVICE_NAME = File.ReadAllText(@"\\" ip @"\Share\bar\SE.dat");
            //    Oracle_sqlcon = "User ID=" UserID ";Password=" Password ";Data Source=(DESCRIPTION = (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = " HOST ")(PORT = " PORT "))) (CONNECT_DATA = (SERVICE_NAME = " SERVICE_NAME ")))";
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("服务器连接失败!");
                //string connString = "User ID=SYSTEM;Password=augur_bdcdj;Data Source=(DESCRIPTION = (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))";//
           string Oracle_sqlcon = "User ID=SYSTEM;Password=Oracle11g;Data Source=(DESCRIPTION = (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))";
                //Oracle_sqlcon = "User ID=bdcdj4;Password=augur_bdcdj4;Data Source=(DESCRIPTION = (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = 19.138.96.43)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))";
            //}
            dataGridView1.DataSource = null;//清空
            OracleConnection conn = new OracleConnection(Oracle_sqlcon);
            conn.Open();
            DataSet dsRet = new DataSet();
            sql = "select distinct userid as 用户号,name as 姓名,studentid as 学号,subject as 科目,achievement as 成绩,Unit as 单元号,CARDID as 身份证号,intime as 录入时间,school as 学校,grade as 年级,class as 班别,fid from students t where name='" textBoxName.Text "' or CARDID = '" textBoxCardId.Text "' ";
            OracleCommand cmd = new OracleCommand(sql, conn);
            OracleDataAdapter adp = new OracleDataAdapter(cmd);
            // DataSet
            dsRet = new DataSet();
            adp.Fill(dsRet);
            dataGridView1.DataSource = dsRet.Tables[0];
            fid = dsRet.Tables[0].Rows[0]["fid"].ToString();
            cmd.Dispose();
            adp.Dispose();
            conn.Close();
            linkLabel1.Text = "查询完成...";
            MessageBox.Show("查询完成!");
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void btn_ReadCard_Click(object sender, EventArgs e)
        {
            AllVisible();
            //trd = new Thread(LoadKernal);
            //trd.Start();
        }

        private void btn_Query_Click(object sender, EventArgs e)
        {
            //trd = new Thread(Query);
            //trd.Start();
            Query();
        }
        private void AllVisible()
        {
            dataGridView1.DataSource = null;//清空
            textBoxCardId.Text = "";
            textBoxName.Text = "";
        }

        private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void Menu_9_Click(object sender, EventArgs e)
        {
            //dt.Dispose(); 
            t.Dispose();
            trd = null;
            GC.Collect();
            this.Close();
            //System.Windows.Forms.Application.Exit();
            //this.Dispose();
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void NameList_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
        }

        private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GC.Collect();
            //dt.Dispose();
            t.Dispose();
            trd = null;
            System.Windows.Forms.Application.Exit();
        }

        private void Tool_Setup_Click(object sender, EventArgs e)
        {

        }

        private void Menu_10_Click(object sender, EventArgs e)
        {
        }

        private void dataGridView4_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
       
        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void butclose_Click(object sender, EventArgs e)
        {
            AllVisible();
        }

        private void 信息录入ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (roleList.Text == "1" || roleList.Text == "2")
            {
                Register form = new Register(roleList.Text);
                form.Show();
            }
            else
            {
                MessageBox.Show("只有管理员权限才可编辑!");
            }
        }

        private void Tool_NewLogon_Click(object sender, EventArgs e)
        {
            Process p = new Process();
            p.StartInfo.FileName = "cmd.exe ";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.CreateNoWindow = true;
            p.Start();
            //启动报表编辑器
            p.StandardInput.WriteLine(@"ReportEditor.exe " "学生信息表.rmf Print " fid " " "曾雄");
            p.Close();
        }

        private void 创建本地备份库ToolStripMenuItem_Click(object sender, EventArgs e)
        {
        
        }

        private void 配置远程数据库ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            F_setupOracle form = new F_setupOracle();
            form.Show();
        }
    }
}