| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1286 人关注过本帖
标题:【求助】:一个想破脑袋的关于SSTab控件问题
只看楼主 加入收藏
Grolia
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-5-20
收藏
 问题点数:0 回复次数:4 
【求助】:一个想破脑袋的关于SSTab控件问题


我想用SSTab控件实现将员工信息分部门显示,运行时并没有显示错误,但是运行出来的结果只有所有员工那一选项卡能显示员工信息,其他选项卡均为空,请各位高手帮我看看以下代码错在哪里,我想很久了。我使用的是VB6.0,XP操作系统。

Private Sub Form_Load()
Dim SQL As String
SQL = "select * from StuffInfo order by SID"
Select Case SSTab.Caption
Case "所有员工"
SQL = "select * from stuffInfo"
Call AllTopic
Call ShowAllRecord(SQL)
Case "总经理室"
SQL = "select * from stuffInfo where SDept= 总经理室"
Call GMOTopic
Call ShowGMORecord(SQL)
Case "副总经理室"
SQL = "select * from stuffInfo where SDept= 副总经理室"
Call VGMOTopic
Call ShowVGMORecord(SQL)
Case "人事部"
SQL = "select * from stuffInfo where SDept= 人事部"
Call PTopic
Call ShowPRecord(SQL)
Case "财务部"
SQL = "select * from stuffInfo where SDept= 财务部"
Call FTopic
Call ShowFRecord(SQL)
Case "企划部"
SQL = "select * from stuffInfo where SDept= 企划部"
Call CPTopic
Call ShowCPRecord(SQL)
Case "销售部"
SQL = "select * from stuffInfo where SDept= 销售部"
Call SaleTopic
Call ShowSaleRecord(SQL)
Case "生产部"
SQL = "select * from stuffInfo where SDept= 生产部"
Call MTopic
Call ShowMRecord(SQL)
End Select
End Sub
Public Sub AllTopic()
Dim i As Integer
With allrecordlist '设置所有员工信息列表表头
.textMatrix(0, 0) = "员工编号"
.textMatrix(0, 1) = "员工姓名"
.textMatrix(0, 2) = "员工性别"
.textMatrix(0, 3) = "员工籍贯"
.textMatrix(0, 4) = "员工年龄"
.textMatrix(0, 5) = "员工生日"
.textMatrix(0, 6) = "员工学历"
.textMatrix(0, 7) = "员工专业"
.textMatrix(0, 8) = "家庭住址"
.textMatrix(0, 9) = "邮政编码"
.textMatrix(0, 10) = "电话号码"
.textMatrix(0, 11) = "Email"
.textMatrix(0, 12) = "参加工作时间"
.textMatrix(0, 13) = "进入公司时间"
.textMatrix(0, 14) = "部门"
.textMatrix(0, 15) = "起薪时间"
.textMatrix(0, 16) = "职务"
.textMatrix(0, 17) = "备注"
For i = 0 To 17 '设置对齐方式
.ColAlignment(i) = 4
Next i
For i = 0 To 7 '设置列宽
.ColWidth(i) = 1400
Next i
.ColWidth(8) = 2000
For i = 9 To 11
.ColWidth(i) = 1400
Next i
.ColWidth(12) = 2000
.ColWidth(13) = 2000
.ColWidth(14) = 1400
.ColWidth(15) = 2000
.ColWidth(16) = 1400
.ColWidth(17) = 3000
End With
End Sub

Public Sub ShowAllRecord(query As String) '显示所有员工信息
Dim rsAll As New ADODB.Recordset
Set rsAll = TransactSQL(query)
If rsAll.EOF = False Then
With allrecordlist
.Rows = 1
While Not rsAll.EOF
.Rows = .Rows + 1
.textMatrix(.Rows - 1, 0) = rsAll(0)
.textMatrix(.Rows - 1, 1) = rsAll(1)
.textMatrix(.Rows - 1, 2) = rsAll(2)
.textMatrix(.Rows - 1, 3) = rsAll(3)
.textMatrix(.Rows - 1, 4) = rsAll(4)
.textMatrix(.Rows - 1, 5) = rsAll(5)
.textMatrix(.Rows - 1, 6) = rsAll(6)
.textMatrix(.Rows - 1, 7) = rsAll(7)
.textMatrix(.Rows - 1, 8) = rsAll(8)
.textMatrix(.Rows - 1, 9) = rsAll(9)
.textMatrix(.Rows - 1, 10) = rsAll(10)
.textMatrix(.Rows - 1, 11) = rsAll(11)
.textMatrix(.Rows - 1, 12) = rsAll(12)
.textMatrix(.Rows - 1, 13) = rsAll(13)
.textMatrix(.Rows - 1, 14) = rsAll(14)
.textMatrix(.Rows - 1, 15) = rsAll(15)
.textMatrix(.Rows - 1, 16) = rsAll(16)
.textMatrix(.Rows - 1, 17) = rsAll(17)
rsAll.MoveNext
Wend
rsAll.Close
End With
End If
End Sub

Public Sub GMOTopic()
Dim i As Integer
With gmorecordlist '设置总经理室员工信息列表表头
.textMatrix(0, 0) = "员工编号"
.textMatrix(0, 1) = "员工姓名"
.textMatrix(0, 2) = "员工性别"
.textMatrix(0, 3) = "员工籍贯"
.textMatrix(0, 4) = "员工年龄"
.textMatrix(0, 5) = "员工生日"
.textMatrix(0, 6) = "员工学历"
.textMatrix(0, 7) = "员工专业"
.textMatrix(0, 8) = "家庭住址"
.textMatrix(0, 9) = "邮政编码"
.textMatrix(0, 10) = "电话号码"
.textMatrix(0, 11) = "Email"
.textMatrix(0, 12) = "参加工作时间"
.textMatrix(0, 13) = "进入公司时间"
.textMatrix(0, 14) = "部门"
.textMatrix(0, 15) = "起薪时间"
.textMatrix(0, 16) = "职务"
.textMatrix(0, 17) = "备注"
For i = 0 To 17 '设置对齐方式
.ColAlignment(i) = 4
Next i
For i = 0 To 11 '设置列宽
.ColWidth(i) = 1400
Next i
.ColWidth(12) = 2000
.ColWidth(13) = 2000
.ColWidth(14) = 1400
.ColWidth(15) = 2000
.ColWidth(16) = 1400
.ColWidth(17) = 3000
End With
End Sub

Public Sub ShowGMORecord(query As String) '显示总经理室员工信息
Dim rsGMO As New ADODB.Recordset
Set rsGMO = TransactSQL(query)
If rsGMO.EOF = False Then
With gmorecordlist
.Rows = 1
While Not rsGMO.EOF
.Rows = .Rows + 1
.textMatrix(.Rows - 1, 0) = rsGMO(0)
.textMatrix(.Rows - 1, 1) = rsGMO(1)
.textMatrix(.Rows - 1, 2) = rsGMO(2)
.textMatrix(.Rows - 1, 3) = rsGMO(3)
.textMatrix(.Rows - 1, 4) = rsGMO(4)
.textMatrix(.Rows - 1, 5) = rsGMO(5)
.textMatrix(.Rows - 1, 6) = rsGMO(6)
.textMatrix(.Rows - 1, 7) = rsGMO(7)
.textMatrix(.Rows - 1, 8) = rsGMO(8)
.textMatrix(.Rows - 1, 9) = rsGMO(9)
.textMatrix(.Rows - 1, 10) = rsGMO(10)
.textMatrix(.Rows - 1, 11) = rsGMO(11)
.textMatrix(.Rows - 1, 12) = rsGMO(12)
.textMatrix(.Rows - 1, 13) = rsGMO(13)
.textMatrix(.Rows - 1, 14) = rsGMO(14)
.textMatrix(.Rows - 1, 15) = rsGMO(15)
.textMatrix(.Rows - 1, 16) = rsGMO(16)
.textMatrix(.Rows - 1, 17) = rsGMO(17)
rsGMO.MoveNext
Wend
rsGMO.Close
End With
End If
End Sub

显示其他部门信息的代码类似

Private Sub allrecordlist_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Button = 2 And Shift = 0 Then
PopupMenu popmenu4.popmenu
End If
End Sub
Private Sub gmorecordlist_mouseup(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Button = 2 And Shift = 0 Then
PopupMenu popmenu4.popmenu
End If
End Sub

Private Sub GMORecordlist_dblclick()
Dim sql3 As String
Dim gmorecordid As String
flag = 2
If frmstaff_count.gmorecordlist.Rows > 1 Then
sql3 = "select*from stuffinfo where sid=" & Trim(frmstaff_count.gmorecordlist.textMatrix(frmstaff_count.gmorecordlist.Row, 0))
frmStuff_info.Show
frmStuff_info.ZOrder 0
gmorecordid = Trim(frmstaff_count.gmorecordlist.textMatrix(frmstaff_count.gmorecordlist.Row, 0))
Else
MsgBox "没有员工信息", vbOKOnly + vbExclamation, "警告"
flag = 1
frmstaff_count.Show
End If
End Sub

搜索更多相关主题的帖子: SSTab 控件 脑袋 
2006-05-20 13:20
VB爱上我
Rank: 6Rank: 6
等 级:贵宾
威 望:25
帖 子:478
专家分:52
注 册:2005-10-14
收藏
得分:0 
Case "总经理室"
SQL = "select * from stuffInfo where SDept= '总经理室'"
Call GMOTopic
Call ShowGMORecord(SQL)

IT618资讯网 提供服务端开发,前端开发,网页特效,热门开源系统研究,软件下载,站长建站,淘宝开店等学习资料.
2006-05-20 15:04
Grolia
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-5-20
收藏
得分:0 

还是不行啊,会不会是其他地方出错了呀?

2006-05-20 16:50
Grolia
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-5-20
收藏
得分:0 
高手们帮帮忙,别见死不救啊!
2006-05-21 11:58
Grolia
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-5-20
收藏
得分:0 
很奇怪的是:我按照VB爱上我的方法,给每个部门都添加了单引号,结果“所有员工”选项卡的信息被清空了,而“总经理室”选项卡则显示了员工编号、姓名等一系列信息表表头,却没有员工信息显示。来来去去都是只有一个选项卡能显示员工信息,这是为什么呀?

本人第一次使用sstab控件,只能求救各位大虾了

[此贴子已经被作者于2006-5-21 12:07:44编辑过]

2006-05-21 12:06
快速回复:【求助】:一个想破脑袋的关于SSTab控件问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.048621 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved