Contents
Dim cn As New ADODB.Connection’连接对象
Dim rs As New ADODB.Recordset        ’记录集
Dim strCn As String’连接字符串
string strCn= "server=’localhost’;database=’TestDataBase’;uid=’uid’;pwd=’pwd’"    ‘连接字符串
cn.Open strCn                            ’打开连接
cn.CursorLocation = adUseClient     '游标类型,存储在客户机的内存中
Dim strSql as string            ’查询字符串
string strSql=”Select * from TestTable”    ’查询字符串
rs.Open strSql, cn, adOpenStatic, adLockOptimistic        ‘查询
while rs.EOF=false
‘在此进行游标的遍历操作
Ewnd

rs.Update        ‘更新数据库
Contents