显示数据记录

fengyetianshi 2003-12-12 01:52:41
怎样用MSFlexGrid控件来显示所查询的记录呢?此控件的一些重要方法有那此。
...全文
31 5 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zhizhi625 2003-12-12
重要方法:
.additem
.clean
重要属性:
.textmatrix
重要事件:
Private Sub Grid_EnterCell()
Private Sub Grid_leaveCell()
  • 打赏
  • 举报
回复
zhizhi625 2003-12-12
msflexgrid支持rdo!不支持ado!
解决方法:
1:将set msflexgrid.datasource=data控件
2:得出一个rescordset,用循环一行一行复值
3:改用支持ado的mshflexgrid控件
  • 打赏
  • 举报
回复
WangPengAn 2003-12-12
比較簡單的就是賦值
set msflexgrid1.datasource=rs

  • 打赏
  • 举报
回复
forever_chang 2003-12-12
我的代码,希望对你有所帮助

'对每个操作人员分别进行统计
If rsHuman.RecordCount > 0 Then

With proCount
.Value = 0
.Max = rsHuman.RecordCount
End With

intID = 0
MSHFlexGrid.Row = 0

Do Until rsHuman.EOF
'控制进度条
proCount.Value = proCount.Value + 1
DoEvents

intID = intID + 1

intAccept = 0
intRepair = 0
intReturn = 0

strUserName = rsHuman("user_name")

'找出与该操作人员有关的机型
strSQL = "SELECT DISTINCT model_code FROM tmp_human_count WHERE (reg_date='" & _
strDate & "' AND reg_name='" & strUserName & "') OR (repair_date='" & _
strDate & "' AND repair_name='" & strUserName & "') OR (return_date='" & _
strDate & "' AND return_name='" & strUserName & "') "

rsModel.Open strSQL, cnnTemp

Do Until rsModel.EOF

MSHFlexGrid.Row = MSHFlexGrid.Row + 1
MSHFlexGrid.Col = 0
MSHFlexGrid.Text = Str(intID)
MSHFlexGrid.Col = 1
MSHFlexGrid.Text = strUserName

strModel = rsModel("model_code")

MSHFlexGrid.Col = 2
MSHFlexGrid.Text = strModel

'统计接收数量
strSQL = "SELECT COUNT(*) AS num FROM tmp_human_count WHERE model_code='" & strModel & "' AND reg_date='" & strDate & "' AND reg_name='" & strUserName & "'"
rsCount.Open strSQL, cnnTemp
MSHFlexGrid.Col = 3
MSHFlexGrid.Text = CStr(rsCount("num"))
intAccept = intAccept + rsCount("num")
rsCount.Close

'统计维修数量
strSQL = "SELECT COUNT(*) AS num FROM tmp_human_count WHERE model_code='" & strModel & "' AND repair_date='" & strDate & "' AND repair_name='" & strUserName & "'"
rsCount.Open strSQL, cnnTemp
MSHFlexGrid.Col = 4
MSHFlexGrid.Text = CStr(rsCount("num"))
intRepair = intRepair + rsCount("num")
rsCount.Close

'统计返回数量
strSQL = "SELECT COUNT(*) AS num FROM tmp_human_count WHERE model_code='" & strModel & "' AND return_date='" & strDate & "' AND return_name='" & strUserName & "'"
rsCount.Open strSQL, cnnTemp
MSHFlexGrid.Col = 5

MSHFlexGrid.Text = CStr(rsCount("num"))
intReturn = intReturn + rsCount("num")
rsCount.Close

rsModel.MoveNext
MSHFlexGrid.AddItem ""
MSHFlexGrid.TopRow = MSHFlexGrid.Row
Loop
rsModel.Close

'生成合计

MSHFlexGrid.Row = MSHFlexGrid.Row + 1
MSHFlexGrid.Col = 0
MSHFlexGrid.Text = Str(intID)
MSHFlexGrid.Col = 1
MSHFlexGrid.Text = strUserName
MSHFlexGrid.Col = 2
MSHFlexGrid.Text = "合计:"
MSHFlexGrid.Col = 3
MSHFlexGrid.Text = intAccept
MSHFlexGrid.Col = 4
MSHFlexGrid.Text = intRepair
MSHFlexGrid.Col = 5
MSHFlexGrid.Text = intReturn
MSHFlexGrid.AddItem ""
MSHFlexGrid.TopRow = MSHFlexGrid.Row
rsHuman.MoveNext
Loop
  • 打赏
  • 举报
回复
wyqwn 2003-12-12
dim rs as new adodb.recordset
dim sql as string
sql="select * from 表"
rs.open sql,cn,1,2
set msflexgrid1.datesource=rs
  • 打赏
  • 举报
回复
相关推荐
发帖
数据库(包含打印,安装,报表)
加入

1198

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
帖子事件
创建了帖子
2003-12-12 01:52
社区公告
暂无公告