mycon.CursorLocation = adUseClient
'使游标在客户端.否则adodb无法与DataGrid绑定
'出现 "行集合不能作为标标签" 错误
mycon.open
'这样一来就无法修改其中的数据了.
'建议用ADODC控件来与DataGrid绑定
Private Sub Form_Load()
mycon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Persist Security Info=False"
'##########################################################
mycon.CursorLocation = adUseClient
'##########################################################
mycon.Open
myrs.Open "select * from 职工基本信息", mycon, 3, 3
Set DataGrid1.DataSource = myrs
DataGrid1.Refresh
End Sub
'希望对你有所帮助
1.看看自己是否已引用ado控件
2.以下定义最好改掉
Dim mycon As New ADODB.Connection
Dim myrs As New ADODB.Recordset
最好为
Dim mycon As ADODB.Connection
Dim myrs As ADODB.Recordset
Private Sub Form_Load()
set mycon = New ADODB.Connection
set myrs = New ADODB.Recordset
.........
3.二楼的是对滴~赶紧把分给人家~~
db="db1.mdb"
mycon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)"
这样试试