我的VB6.0为什么不能使用NEW 关键字  Set adoPrimaryRS = New Recordset提示是"invalid use of New keyword"
请问这是什么原因..还是语法错了?

解决方案 »

  1.   

    Set adoPrimaryRS = New ADODB.Recordset
      

  2.   

    我一般直接定义:Dim adoPrimaryRS As New ADODB.Recordset
      

  3.   

    Set adoPrimaryRS = New ADODB.Recordset
    或者
    Dim adoPrimaryRS As New ADODB.RecordSet
      

  4.   

    工程=>引用=>Microsoft ActiveX Dtat Objects 2.5 Library 选项中试试看,我上次也碰到过类似的情况!!!
      

  5.   

    还是不行..那边是够上了..但PROJECT EXPLOROR下去没显示引用为什么啊??
      

  6.   

    PROJECT EXPLOROR下去没显示引用?
    -------------------PROJECT EXPLOROR里有没有missing....? 去掉,重新引用
      

  7.   

    谢谢大家..我的问题是
    1.我的VB6.0为什么不能使用NEW 关键字  
    Set adoPrimaryRS = New Recordset
    提示是"invalid use of New keyword
    2.PROJECT EXPLOROR下去没显示引用
      

  8.   

    因为你这里的Recordset类是一个无法创建的类
      

  9.   

    工程=>引用=>Microsoft ActiveX Dtat Objects 2.5 Library选中就可以了
      

  10.   

    打補丁啊!VB6的補丁包 VS6sp6VB 中包含的有ADO的2.5和以上的版本。
    可以解決很多這種問題.
      

  11.   

    我打过了..
       strsql = "select huohao, mingcheng, pingpai, yangshi, leixing," _
           & " yanse, cailiao, chicun1, chicun2," _
           & "changdi, tupian, jiage, shuliang, shangshiri," _
           & " faburi, jieshao, xiedi " _
           & " from product "
       
        strsql = "select * from  product  "
       Set Con = CreateObject("ADODB.Connection")
       '使用数据源来连接数据库
       Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\product.mdb;" & ";Persist Security Info=False"      Dim rs As New ADODB.Recordset
           Set rs = Con.Execute(strsql)
           Dim flag As Integer
       
       
       Set DataGrid1.DataSource = rs这样一直绑不上去....又不知道咋了
      

  12.   

    要么把注册表里的相关键删除掉,然后再重装一下最新版的mdac