标题:MSFlexGrid1控件将ACCESS数据库中的已有的信息显示出来的代码?
只看楼主
wangyiaihu
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2020-4-22
结帖率:100%
 问题点数:0 回复次数:2 
MSFlexGrid1控件将ACCESS数据库中的已有的信息显示出来的代码?


如图上,数据添加到数据库后,需要显示到SFlexGrid1控件,
请大神指导,代码该怎么写?
搜索更多相关主题的帖子: 信息 显示 代码 控件 数据库 
2020-04-28 16:41
wangyiaihu
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2020-4-22
得分:0 


请知道的,会写的 大神 指导,谢谢。。。
2020-04-28 16:42
wangyiaihu
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2020-4-22
得分:0 
程序代码:
Private Sub Image2_Click()
Image2.Picture = Form2.Image37.Picture

If Combo1.Text = "" Or Combo2.Text = "" Or Combo3.Text = "" Or Combo4.Text = "" Or Combo5.Text = "" Then
Image4.Visible = True
    Image4.Picture = Form2.Image49.Picture
Exit Sub
End If
If Combo1.Text <> "" And Combo2.Text <> "" And Combo3.Text <> "" And Combo4.Text <> "" And Combo5.Text <> "" Then
'往ACCESS数据库中插入信息代码
Call KKK(conn)
RS.Open "select * from 数据 '", conn, 3, 2
    
    RS.AddNew
    RS!设备编号 = Trim(Combo1.Text)
    RS!抽屉台车号 = Trim(Combo2.Text)
    RS!坏点位置 = Trim(Combo3.Text)
    RS!坏点现象 = Trim(Combo4.Text)
    RS!确认状态 = Trim(Combo5.Text)
    RS!提交人员 = Trim(Label1.Caption)
    RS!权限 = Trim(Label2.Caption)
    RS!班次 = Trim(Label3.Caption)
  RS!所属 = Trim(Label4.Caption)
    RS!提交日期 = Trim(Label5.Caption)
    RS!提交时间 = Trim(Label6.Caption)
    Image4.Visible = True

    Image4.Picture = Form2.Image48.Picture

 RS.Update
    RS.Close
    conn.Close
    Set RS = Nothing
    Set conn = Nothing

Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""

 Combo1.SetFocus

Exit Sub
End If

MSFlexGrid1.Clear
MSFlexGrid1.Visible = True
With MSFlexGrid1   
    .Cols = 12  
    .Rows = 1    
   
    .TextMatrix(0, 0) = Space(3) & "序号"    
    .TextMatrix(0, 1) = Space(6) & "设备编号"
    .TextMatrix(0, 2) = Space(6) & "抽屉台车号"
    .TextMatrix(0, 3) = Space(6) & "坏点位置"
    .TextMatrix(0, 4) = Space(6) & "坏点现象"
    .TextMatrix(0, 5) = Space(6) & "确认状态"
    .TextMatrix(0, 6) = Space(6) & "提交人员"
    .TextMatrix(0, 7) = Space(3) & "权限"                   
    .TextMatrix(0, 8) = Space(3) & "班次"
      .TextMatrix(0, 9) = Space(3) & "所属"
      .TextMatrix(0, 10) = Space(6) & "提交日期"
      .TextMatrix(0, 11) = Space(6) & "提交时间"
    
    .ColWidth(0) = 800  
    .ColWidth(1) = 1500
    .ColWidth(2) = 1500
    .ColWidth(3) = 1500
    .ColWidth(4) = 1500
    .ColWidth(5) = 1500
        .ColWidth(6) = 1500
        .ColWidth(7) = 1000
        .ColWidth(8) = 1000   
        .ColWidth(9) = 1000
        .ColWidth(10) = 1500
        .ColWidth(11) = 1500
  
End With

End Sub


以上代码中,怎么追加让MSFlexgrid控件显示ACCESS数据库中已有的信息,
2020-04-28 19:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-501309-1-1.html




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

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