为什么字段更新会抛出 Binding Collection Error

Why is field update throwing Binding Collection Error

我有一个 VB6 应用程序,它使用 ADODB 2.8 连接到 SQL 服务器。我已经声明了绑定和记录集。信息显示正确。不过,当我尝试更新任何字段时,我收到一条错误消息:

Binding Collection Error

Field not updatable, Bound Property Name: Text, Field Name: DTMOUVEMEN

我很确定这与 ADODB.Recorset 的创建方式有关,但我不知道,VB6 不是我的专业领域。

我的窗体中绑定到 ADODC 的文本框是这样的

  Begin VB.TextBox DTMOUVEMENT 
     BackColor       =   &H00E0E0E0&
     DataField       =   "DTMOUVEMEN"
     DataSource      =   "DataTYPEMOUVEMENTADO"
     Height          =   315
     Left            =   2820
     Locked          =   -1  'True
     TabIndex        =   1
     TabStop         =   0   'False
     Text            =   "DTMOUVEMENT"
     Top             =   2820
     Width           =   2895
  End

ADODC组件是这样定义的

Begin MSAdodcLib.Adodc DataTYPEMOUVEMENTADO 
  Height          =   330
  Left            =   5800
  Top             =   2500
  Width           =   2295
  _ExtentX        =   4048
  _ExtentY        =   582
  ConnectMode     =   0
  CursorLocation  =   3
  IsolationLevel  =   -1
  ConnectionTimeout=   15
  CommandTimeout  =   30
  CursorType      =   3
  LockType        =   3
  CommandType     =   8
  CursorOptions   =   0
  CacheSize       =   50
  MaxRecords      =   0
  BOFAction       =   0
  EOFAction       =   0
  ConnectStringType=   1
  Appearance      =   1
  BackColor       =   -2147483643
  ForeColor       =   -2147483640
  Orientation     =   0
  Enabled         =   -1
  Connect         =   ""
  OLEDBString     =   ""
  OLEDBFile       =   ""
  DataSourceName  =   ""
  OtherAttributes =   ""
  UserName        =   ""
  Password        =   ""
  RecordSource    =   ""
  Caption         =   "DataTYPEMOUVEMENTADO"
  BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
     Name            =   "MS Sans Serif"
     Size            =   8.25
     Charset         =   0
     Weight          =   400
     Underline       =   0   'False
     Italic          =   0   'False
     Strikethrough   =   0   'False
  EndProperty
  _Version        =   393216
End

ADODC 组件是这样绑定的

strSQL = "here goes the sql query"
Set adoRS = New ADODB.Recordset
With adoRS
    .CursorLocation = adUseServer
    .CursorType = adOpenDynamic
    .LockType = adLockOptimistic
    .Open strSQL, adoDbConn 
End With
Set Me.DataTYPEMOUVEMENTADO.Recordset = adoRS

连接是这样定义的

    Set adoDbConn = New ADODB.Connection

    ' Specify the OLE DB provider.
    adoDbConn.Provider = "sqloledb"
    adoDbConn.Mode = adModeReadWrite
    adoDbConn.Open "connection string data"

好的,所以我发现了错误。对于这种特殊情况,SQL 查询定义错误,因此没有字段 DTMOUVEMEN 在 Adodc 记录集中设置。