none
!!!急求ADODC控件属性设定问题 RRS feed

  • 常规讨论

  • 从vb6代码直接转到vb.net中,发现控件ADODC在编辑阶段必须要将属性ConnectionString和RecordSource设定有值,如果没有在编辑中选择空件Axfpspread的属性DataSource为ADODC1的时候,要弹出错误,错误Error-2147217908 command对象的commandtext未被设定(如果将recordSource在属性中给空),请问该如何对应!
    因为我是在程序在通过编码的形式来给其设定值。
    关于控件的部分信息:

    [designer]

    Me.adoDataTable.BackColor = System.Drawing.SystemColors.Window
            Me.adoDataTable.BOFAction = Microsoft.VisualBasic.Compatibility.VB6.ADODC.BOFActionEnum.adDoMoveFirst
            Me.adoDataTable.CacheSize = 10
            Me.adoDataTable.CommandTimeout = 0
            Me.adoDataTable.CommandType = ADODB.CommandTypeEnum.adCmdUnknown
            Me.adoDataTable.ConnectionString = ""
            Me.adoDataTable.CursorLocation = ADODB.CursorLocationEnum.adUseClient
            Me.adoDataTable.CursorType = ADODB.CursorTypeEnum.adOpenStatic
            Me.adoDataTable.EOFAction = Microsoft.VisualBasic.Compatibility.VB6.ADODC.EOFActionEnum.adDoMoveLast
            Me.adoDataTable.Font = New System.Drawing.Font("MS PGothic", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(128, Byte))
            Me.adoDataTable.ForeColor = System.Drawing.SystemColors.WindowText
            Me.adoDataTable.Location = New System.Drawing.Point(355, 174)
            Me.adoDataTable.LockType = ADODB.LockTypeEnum.adLockReadOnly
            Me.adoDataTable.Mode = ADODB.ConnectModeEnum.adModeUnknown
            Me.adoDataTable.Name = "adoDataTable"
            Me.adoDataTable.Orientation = Microsoft.VisualBasic.Compatibility.VB6.ADODC.OrientationEnum.adHorizontal
            Me.adoDataTable.Size = New System.Drawing.Size(113, 25)
            Me.adoDataTable.TabIndex = 9
            Me.adoDataTable.Text = "Adodc1"
            Me.adoDataTable.Visible = False

    [code]

            With Me.adoDataTable
                .ConnectionString = "FILE NAME=" & App.Path & "\" & "MTM Source.udl"
                .ConnectionString = gstrSKPDBUDLSettingInfo
                '2005/05/17 Yamamoto modify end
                .CommandType = ADODB.CommandTypeEnum.adCmdText
                .RecordSource = strSql
                .Refresh()
                .Text = CStr(.Recordset.recordCount)
            End With
    wis_it
    • 已编辑 wis_it 2009年7月17日 10:06
    • 已更改类型 wis_it 2009年8月12日 8:44
    2009年7月17日 10:05

全部回复