Private Sub Command2_Click()
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VB\数据库\db1.mdb"
For i = 1 To 3
Adodc2.RecordSource = "select sum([i]) as 和 from 表1"
Adodc2.Refresh
Text2(i - 1).Text = Adodc2.Recordset.Fields("和")
Next
End Sub
如上..如果没加FOR NEXT 上面可以把SUM(1)字段名称下数值求和,取回到Text2(0)中来.
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VB\数据库\db1.mdb"
For i = 1 To 3
Adodc2.RecordSource = "select sum([i]) as 和 from 表1"
Adodc2.Refresh
Text2(i - 1).Text = Adodc2.Recordset.Fields("和")
Next
End Sub
如上..如果没加FOR NEXT 上面可以把SUM(1)字段名称下数值求和,取回到Text2(0)中来.