首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

为什么总出现 method 'open' of object'_Recordset' failed的有关问题啊

2012-01-02 
为什么总出现 method open of object_Recordset failed的问题啊,请指教!PrivateSubADO_OpenRecordsets

为什么总出现 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

热点排行