dim cn as new adodb.connection dim rs as new adodb.recordset cn.open "Provider=SQLOLEDB.1;Password=密码;Persist Security Info=True;User ID=sa;Initial Catalog=数据库;Data Source=服务器" rs.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.open "select * from xxx",cn
... rs.close set rs=nothing cn.close set cn=nothing
dim rs as new adodb.recordset
cn.open "Provider=SQLOLEDB.1;Password=密码;Persist Security Info=True;User ID=sa;Initial Catalog=数据库;Data Source=服务器"
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.open "select * from xxx",cn
...
rs.close
set rs=nothing
cn.close
set cn=nothing
就是这个,另外多看MSDN,里面啥都有。