扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:wyh 来源:论坛 2007年10月14日
关键字:
Private Sub Command1_Click() Dim query As Recordset Dim numofpeople As Integer, maxage As Integer, minage As Integer Dim avgsalary As Single, totalsalary As Single Set query = Data1.Database.OpenRecordset("SELECT COUNT(*) as num, MAX(年龄) as maxa," _ & "MIN(年龄) as mina, AVG(工资) as avgs, SUM(工资) as sums FROM salary ") numofpeople = query.Fields("num") .Value maxage = query.Fields("maxa") .Value minage = query.Fields("mina") .Value avgsalary = Format(query.Fields("avgs") .Value, "0.00") ' 结果保留两位小数 totalsalary = query.Fields("sums") .Value StatusBar1.Panels(1).Text = "人数:" & numofpeople StatusBar1.Panels(2).Text = "最大年龄:" & maxage StatusBar1.Panels(3).Text = "最小年龄:" & minage StatusBar1.Panels(4).Text = "平均工资:" & avgsalary StatusBar1.Panels(5).Text = "工资总额:" & totalsalary End Sub |
Data1.RecordSource = "SELECT COUNT(*) as num, MAX(年龄) as maxa, MIN(年龄) as mina, " _ & " AVG(工资) as avgs, SUM(工资) as sums FROM salary " Data1.Refresh numofpeople = Data1.Recordset.Fields("num") .Value maxage = Data1.Recordset.Fields("maxa") .Value minage = Data1.Recordset.Fields("mina") .Value avgsalary = Format(Data1.Recordset.Fields("avgs") .Value, "0.00") totalsalary = Data1.Recordset.Fields("sums") .Value |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者