提供一个方便的办法,用ODBC连接数据库~ dim conn as new adodb.connection dim rs as new adodb.recordset dim sql as string sql ="select 字段1 from 表" conn.open "DSN=ODBC连接名字" rs.open sql,conn,3,3 if rs.bof and rs.eof then for i = 1 to rs.recordcount print rs.fields("字段1") rs.movenext next i else print "没有记录" end if
dim conn as new adodb.connection
dim rs as new adodb.recordset
dim sql as string
sql ="select 字段1 from 表"
conn.open "DSN=ODBC连接名字"
rs.open sql,conn,3,3
if rs.bof and rs.eof then
for i = 1 to rs.recordcount
print rs.fields("字段1")
rs.movenext
next i
else
print "没有记录"
end if