重庆邮电大学吧 关注:246,342贴子:8,110,129
  • 1回复贴,共1

有没有vb的大神?

只看楼主收藏回复

帮忙注释下这段代码,好人一生平安


来自Android客户端1楼2016-05-25 17:44回复
    主要源代码如下:
    公共模块
    Public Cn As New ADODB.Connection ''连接数据库
    Public UserID As String ''用户名称
    Public ItemName As String ''项目名称
    Public strTableName As String ''表名
    Public UserType As String
    Public SelData(10)
    Const DayLastFine = 0.5 '定义超期每天费用0.5元
    Sub Init()
    ItemName = "图书管理系统"
    Call ConnectData
    End Sub
    Sub ConnectData()
    If Cn.State Then Cn.Close
    Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\database.mdb;Persist Security Info=False"
    Cn.Open
    End Sub
    Sub LoadGrid(mfg As MSHFlexGrid, rstSql As String)
    Dim rst As New ADODB.Recordset
    rst.Open rstSql, Cn, adOpenStatic, adLockReadOnly
    With mfg
    .Clear
    .Rows = 2
    .Cols = rst.Fields.Count
    For i = 0 To rst.Fields.Count - 1
    .TextMatrix(0, i) = Trim(rst(i).Name)
    .ColWidth(i) = (.Width - 500) / .Cols
    Next i
    While Not rst.EOF
    For i = 0 To rst.Fields.Count - 1
    If Not IsNull(rst(i)) Then .TextMatrix(.Rows - 1, i) = Trim(rst(i))
    Next i
    .Rows = .Rows + 1
    rst.MoveNext
    Wend
    End With
    End Sub


    来自Android客户端3楼2016-05-25 18:15
    回复