2020-03-02 08:08:16 来源:范文大全收藏下载本文
1.Select * from student查询所有原始记录
2.Select StudentID, StudentName from student 只查询学号和姓名
3.Select StudentID as 学号, StudentName as 姓名, Sex as 性别,Cla as 班级,NormalScore as平时成绩,ExperimentScore as 实验成绩, ExaminationScore as 考试成绩 from student
4.Select * from student where sex=’男’只需要查看男生的成绩
5.Select * from student where NormalScore>80只需要查看平时成绩大于80分的记录
6.Select * from student where studentname like ‘陈%’查询姓陈的同学的记录
7.Select * from student order by examinationScore根据考试成绩排序
8.Select * from student order by examinationScore排序---降序
9.Select Sum(examinationScore) as 总成绩 from student求总成绩
10.Select Avg(examinationScore) as平均成绩 from student求平均成绩
11.Select count(*) as 总记录数 from student求总记录数
12.Select Max(ExaminationScore) as 最高分 from student求最高分
13.Select Min(ExaminationScore) as 最高低分 from student求最低分
14.Select Cla as 班级, Avg(ExaminationScore) as平均成绩 from student group by cla各班级成绩的分类汇总
Public Cla frmMain
Private ObjCnn As New OleDbConnection
Private ObjCmd As OleDbCommand
Private StrDir As String = "D:\MIS1025\StudentMgr.accdb"
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ObjCnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & StrDir
ObjCnn.Open()
ObjCmd = New OleDbCommand
ObjCmd.Connection = ObjCnn
End Sub
Private Sub FindRecord(ByVal StrSQL As String)
ObjCmd.CommandText = StrSQL
Dim rd As OleDbDataReader = ObjCmd.ExecuteReader
Dim tbl As New DataTable
tbl.Load(rd)
DataGridView1.DataSource = tbl
End Sub
Private Sub CmdFind_Click(ByVal sender As System.Object,
System.EventArgs) Handles CmdFind.Click
FindRecord(txtSQL.Text)
End Sub ByVal e As
人人范文网 m.inrrp.com.cn 手机版