資源簡介
最基本功能需求:1. 能夠?qū)崿F(xiàn)根據(jù)以下關(guān)鍵字查詢:學(xué)生姓名、學(xué)號、班級、課程名稱。2. 能夠?qū)崿F(xiàn)按照單科成績、總成績、平均成績、學(xué)號排序。3. 能夠?qū)崿F(xiàn)學(xué)生成績信息的插入、刪除和修改。4. 能夠查詢每個課程的最高分、最低分及相應(yīng)學(xué)生姓名、班級和學(xué)號。5. 能夠查詢每個班級某門課程的優(yōu)秀率(90分及以上)、不及格率,并進行排序

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.Data.SqlClient;
namespace?WindowsFormsApplication1
{
????public?partial?class?Login?:?Form
????{
????????private?static?String?constr?=?“initial?catalog=XSGLXT;server=.;Integrated?Security=True;“;//聲明數(shù)據(jù)庫連接字符串
????????public?Login()
????????{
????????????InitializeComponent();
????????}
????????private?void?Button1_Click(object?sender?EventArgs?e)
????????{
????????????string?commandText=““;
????????????SqlConnection?conn?=?new?SqlConnection(constr);//創(chuàng)建數(shù)據(jù)庫連接
????????????//選擇類型創(chuàng)建不同的SQL命令語句
????????????if?(Type.Text?==?“教師“)
????????????????commandText?=?“select?*?from?老師密碼信息表?where?職工號=‘“?+?Number.Text.Trim()?+?“‘a(chǎn)nd?密碼=‘“?+?Password.Text.Trim()?+?“‘“;
????????????else?
????????????????if?(Type.Text?==?“學(xué)生“)
????????????????????commandText?=?“select?*?from?學(xué)生密碼信息表?where?學(xué)號=‘“?+?Number.Text.Trim()?+?“‘a(chǎn)nd?密碼=‘“?+?Password.Text.Trim()?+?“‘“;
????????????SqlCommand?cmd?=?new?SqlCommand(commandText?conn);//實例化一個sqlcommand對象來執(zhí)行sql命令
????????????try
????????????{
????????????????conn.Open();//打開數(shù)據(jù)庫
????????????????SqlDataReader?reader?=?cmd.ExecuteReader();//實例化一個數(shù)據(jù)閱讀對象
????????????????if?(reader.Read())//如果搜索到這一條數(shù)據(jù)
????????????????{
????????????????????if?(Type.Text?==?“學(xué)生“)
????????????????????{
????????????????????????Student_system?f2?=?new?Student_system(Number.Text?Password.Text);//實例化一個學(xué)生功能系統(tǒng)窗體
????????????????????????f2.Show();
????????????????????}
????????????????????if(Type.Text?==?“教師“)
????????????????????{
????????????????????????Teacher_system?f3?=?new?Teacher_system(Number.Text?Password.Text);//實例化一個教師功能系統(tǒng)窗體
????????????????????????f3.Show();
????????????????????}
?????????????????this.Hide();//隱藏這個窗體
????????????????}
????????????????else?
????????????????????if(!reader.Read())
????????????????{
????????????????????MessageBox.Show(“號碼或密碼有誤,請重新登錄!“);//彈窗
????????????????????Number.Text?=?““;
????????????????????Password.Text?=?““;
????????????????}
????????????}
????????????catch?(SqlException?err)
????????????{
????????????????MessageBox.Show(err.ToString());
????????????}
????????????finally
????????????{
????????????????conn.Close();
????????????}
????????}
????????private?void?Button2_Click(object?sender?EventArgs?e)
????????{
????????????Application.Exit();//退出程序
????????}
????????private?void?Login_Load(object?sender?EventArgs?e)
????????{
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-01-08?13:56??學(xué)生成績管理系統(tǒng)\
?????目錄???????????0??2017-01-08?13:56??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\
?????目錄???????????0??2017-01-09?20:26??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\
?????文件????????1041??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1.sln
?????文件???????55296??2017-01-09?20:26??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1.v12.suo
?????文件?????????187??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\App.config
?????目錄???????????0??2017-01-08?14:50??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\
?????目錄???????????0??2017-01-08?13:56??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\
?????文件???????38912??2017-01-09?20:24??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
?????文件?????????187??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
?????文件???????69120??2017-01-09?20:24??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
?????文件???????24224??2017-01-09?20:25??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
?????文件?????????187??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
?????文件?????????490??2013-03-18?17:00??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
?????目錄???????????0??2017-01-08?14:50??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\
?????文件????????2933??2017-01-09?19:22??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\Login.cs
?????文件????????6738??2017-01-08?15:06??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\Login.Designer.cs
?????文件????????5817??2017-01-08?15:06??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\Login.resx
?????目錄???????????0??2017-01-08?13:56??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\
?????目錄???????????0??2017-01-09?20:24??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\
?????文件????????1453??2016-12-15?09:13??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????7103??2017-01-08?15:07??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????????0??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件???????????0??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件???????????0??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????目錄???????????0??2016-12-15?09:03??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\TempPE\
?????文件????????2850??2017-01-09?20:25??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
?????文件????????1285??2017-01-09?19:47??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
?????文件????????2211??2016-12-15?09:10??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csprojResolveAssemblyReference.cache
?????文件???????38912??2017-01-09?20:24??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe
?????文件?????????180??2017-01-08?15:45??學(xué)生成績管理系統(tǒng)\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Login.resources
............此處省略20個文件信息
評論
共有 條評論