什么是recordsoure?是不是recordset啊?

解决方案 »

  1.   

    不对吧,我试验了一下,click事件是响应的,change事件是不响应的。
    Private Sub Combo1_Change()
        MsgBox "aaa"
    End SubPrivate Sub Combo1_Click()
        MsgBox "bbb"End SubPrivate Sub Form_Load()
        Combo1.AddItem "aaa"
        Combo1.AddItem "bbb"
        Combo1.AddItem "ccc"
    End Sub
     
      

  2.   

    第一个问题是SQL语句错,正确的写法为"select a.*, b.* from dd_b a, dw_b b"或
    "select dd_b.*, dw_b.* from dd_b, dw_b",不过你需要确定这两个数据库表中没有同名字段。如果有,必须将同名字段去掉。
    第二个问题有点奇怪,Click事件一般是在对Item选择时被触发的。ComboBox中的Change事件只有在手工输入或程序改变内容时的时候才会被触发的。可能你的程序中没有处理好。可以参考MSDN中的有关资料。
      

  3.   

    同意river99的意见,同时recordsoure也可以用以下简单表示:
    recordsource=数据表名。(CommandType=2)
    第二个问题,Click事件应该会被触发的。
      

  4.   

    第一个问题:
        用法没有错,可以直接SELECT 字段的名称,但有两个前提,1,字段名不能有重复;2,必须先设置ADODC的COMMANDTYPE=2,即SQL语句;
    第二个问题:
        CLICK 事件应当触发,没有触发的原因可能是其他语句的问题,单步执行看看。
      

  5.   

    对不起,我是初学者有几个单词写错了
    分我已经给了,可以告诉我commandtype几个参数的具体意义吗?
      

  6.   

    Adodc1 属性设置如下:   Begin MSAdodcLib.Adodc Adodc1 
          Height          =   435
          Left            =   510
          Top             =   1950
          Width           =   2895
          _ExtentX        =   5106
          _ExtentY        =   767
          ConnectMode     =   0
          CursorLocation  =   3
          IsolationLevel  =   -1
          ConnectionTimeout=   15
          CommandTimeout  =   30
          CursorType      =   3
          LockType        =   3
          CommandType     =   2
          CursorOptions   =   0
          CacheSize       =   50
          MaxRecords      =   0
          BOFAction       =   0
          EOFAction       =   0
          ConnectStringType=   1
          Appearance      =   1
          BackColor       =   -2147483643
          ForeColor       =   -2147483640
          Orientation     =   0
          Enabled         =   -1
          Connect         =   "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=G:\sdf\data.mdb"      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=G:\sdf\data.mdb"      OLEDBFile       =   ""
          DataSourceName  =   ""
          OtherAttributes =   ""
          UserName        =   ""
          Password        =   ""
          RecordSource    =   "tb_data"
          Caption         =   "Adodc1"
          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
             Name            =   "宋体"
             Size            =   9
             Charset         =   134
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          _Version        =   393216
       End程序中:
    Private Sub Command1_Click()
        Adodc1.RecordSource = "select da_bm,da_name,da_s1,da_s2,da_s3 from tb_da where da_year='1999'"    Adodc1.Refresh
    End Sub 程序运行出错,提示“FROM子句错”不知道是怎么回事,我要急死了,VB高手帮帮忙吧。