为什么总出现 method 'open' of object'_Recordset' failed的问题啊,请指教!
Private Sub ADO_OpenRecordsets()
'++ Open the two recordsets
On Error GoTo ErrorHandler
Dim tmp_rs As ADODB.Recordset
Set tmp_rs = New ADODB.Recordset
tmp_rs.Open "Select * from " & Text2.Text, pAdoCon, adOpenForwardOnly, adLockReadOnly
attSQLstr = GetAttrFlds(tmp_rs)
tmp_rs.Close
Set tmp_rs = Nothing
Set pAdoRs_att = New ADODB.Recordset
Set pAdors_geom = New ADODB.Recordset
'++ Open a new geometry-only recordset
pAdors_geom.Open "Select " & sSpatialGeomColNameParam & " from " & Text2.Text, pAdoCon, adOpenForwardOnly, adLockReadOnly
'++ Open a new attribute-only recordset
pAdoRs_att.Open "Select " & attSQLstr & " from " & Text2.Text, pAdoCon, adOpenForwardOnly, adLockOptimistic
Exit Sub
[解决办法]
发现你是这样写的,
tmp_rs.Open "Select * from " & Text2.Text, pAdoCon, adOpenForwardOnly, adLockReadOnly
不知道是你失误写错,还是......
试一下这样
tmp_rs.Open "Select * from " & Text2.Text & " ", pAdoCon, adOpenForwardOnly, adLockReadOnly