回复 7楼 lowxiong
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub Form_Load()
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.ConnectionString = "Data Source=" & App.Path & "\data.mdb" & " ;Jet OLEDB:Database password= coucongzi" ';Persist Security Info=False"
cn.Open
rs.CursorLocation = adUseClient
rs.Open "select * from 成绩", cn, adOpenDynamic, adLockPessimistic
Label1.Caption = Sum(rs.Fields("语文"))
Label2.Caption = Sum(rs.Fields("数学"))
rs.Close
cn.Close
End Sub
这样写可以吗?执行之后会有报错提示“子程序或函数未定义”,改如何修改呢?