?? student.cs
字號:
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;
namespace CMS
{
public partial class student : Form
{
public student()
{
InitializeComponent();
}
private void 信息查詢ToolStripMenuItem_Click(object sender, EventArgs e)
{
SqlConnection conn = null;
DataSet ds = new DataSet();
try
{
using (conn = new SqlConnection(@"server=GEM\MIRROR;database=sky;integrated security=true;"))
{
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from dbo.sky_student", conn);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
//conn = new SqlConnection("server=localhost;database=zoo;integrated security=true;");
//conn.Open();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void student_Load(object sender, EventArgs e)
{
this.toolStripStatusLabel1.Text = "登錄人:" + UserHelper.user;
}
private void student_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
private void 成績查詢ToolStripMenuItem1_Click(object sender, EventArgs e)
{
SqlConnection conn = null;
DataSet ds = new DataSet();
try
{
using (conn = new SqlConnection(@"server=GEM\MIRROR;database=sky;integrated security=true;"))
{
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from dbo.sky_grade", conn);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
//conn = new SqlConnection("server=localhost;database=zoo;integrated security=true;");
//conn.Open();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
private void 密碼修改ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void 個人信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void 選修課程ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void 課程信息ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -