如何处理DBGrid控件?

时间:2013-02-19 09:43:28

标签: oracle vb6

    SQL> desc admin
                 Name Null? Type
           -------------------------------------
                NAME VARCHAR2(20)
                PRIVILEDGE VARCHAR2(20)
                CODE NUMBER(38)
                PASS VARCHAR2(20)

              Private Sub Form_Load()
              Set RS = New ADODB.Recordset
              If RS.State = 1 Then RS.Close
              opencn
              RS.Open "ADMIN", CN, adOpenDynamic, adLockOptimistic, adCmdTable
              Set DBGrid1.DataSource = RS
RS.Close
End Sub

我遇到错误

*Error 430 at line : Set DBGrid1.DataSource = RS
Class does not support automation or does not support expected interface*

1 个答案:

答案 0 :(得分:0)

数据绑定网格(DBGrid)用于DAO,而DataGrid用于ADO。

在工具箱中:右键单击,选择“组件...”,并确保选中'Microsoft DataGrid Control 6.0 (SP6) (OLEDB)' 'Microsoft Data Bound Grid Control 5.0 (SP3)'