VB连接SQL数据库取数
Set mCnn = New ADODB.Connection
'mCnn.ConnectionString = .Cnnstring
mCnn.ConnectionString ="Provider=SQLOLEDB;Data Source=127.0.0.1;Initial Catalog=AIS20200125211035;User ID=sa;Password=123456;"
mCnn.CursorLocation = adUseClient
mCnn.Open '打开数据源
Set rs = New ADODB.Recordset
rs.Open "select * from T_User", mCnn, adOpenDynamic, adLockBatchOptimistic
If rs.RecordCount > 0 Then
For i = 1 To rs.RecordCount
.SetFieldValue "FDecimal44", Val(rs.Fields("Amt")), i
rs.MoveNext
Next i
End If
rs.Close