Dim CN As New ADODB.Connection '定义数据库的连接
Dim Rs As New ADODB.Recordset
CN.ConnectionString = "Provider=sqloledb;Data Source=pmserver;Initial Catalog=northwind;User Id=sa;Password=sa;"
CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\student.mdb"
'用绑定
if rs.state=adstateopen then rs.close
rs.open "select * from tablename",conn,adopenkeyset,adlockreadonly
set mshflexgrid.datasource=rs
set rs=nothing