dim cn as new adodb.connection
dim rs as new adodb.recordset
dim rsvar as variant
dim i as integer
cn.open "testing" '<-- your dsn
rs.open "select * from cies", cn, adopenstatic, adlockoptimistic
rs.movelast
rs.movefirst
' assuming that rs is your ado recordset
mshflexgrid1.rows = rs.recordcount + 1
rsvar = rs.getstring(adclipstring, rs.recordcount)
mshflexgrid1.cols = rs.fields.count
' set column names in the grid
for i = 0 to rs.fields.count - 1
mshflexgrid1.textmatrix(0, i) = rs.fields(i).name
next
mshflexgrid1.row = 1
mshflexgrid1.col = 0
' set range of cells in the grid
mshflexgrid1.rowsel = mshflexgrid1.rows - 1
mshflexgrid1.colsel = mshflexgrid1.cols - 1
mshflexgrid1.clip = rsvar
' reset the grid's selected range of cells
mshflexgrid1.rowsel = mshflexgrid1.row
mshflexgrid1.colsel = mshflexgrid1.col
rs.close
set rs = nothing
cn.close
set cn = nothing