DataGrid1,MSHFlexGrid1为什么只有后者能显示数据,前者为什么不显示,使用ADODC设置可以连接数据库并显示
If cn.State = adStateOpen Then cn.CloseIf rs.State = adStateOpen Then rs.Close
cn.Open "provider=microsoft.ace.oledb.12.0;Data Source=" & App.Path & "\库.accdb;Jet OLEDB:Database Password=111;"
sql = "select * from 系统数据表 "
rs.Open sql, cn, 3, 3
If rs.EOF And rs.BOF Then
If cn.State = adStateOpen Then cn.Close
If rs.State = adStateOpen Then rs.Close
Exit Sub
Else
Set DataGrid1.DataSource = rs
'DataGrid1.Refresh
Set MSHFlexGrid1.DataSource = rs
'End If
If cn.State = adStateOpen Then cn.Close
If rs.State = adStateOpen Then rs.Close