I have a VB6 app that connects to a SQL Server server by using ADODB 2.8. I have declared the bindings and the recordsets. The information is being shown correctly. Still, when I try to update any field, I get an error saying:
Binding Collection Error
Field not updatable, Bound Property Name: Text, Field Name: DTMOUVEMEN
I am pretty sure it has something to do with the way the ADODB.Recorset is being created, but I have no idea, VB6 is not my field of expertise.
The textBox in my form that is binded to a ADODC is like this
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
The ADODC component is defined like this
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
The ADODC component is being binded like this
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
The connection is being defined like this
Set adoDbConn = New ADODB.Connection
' Specify the OLE DB provider.
adoDbConn.Provider = "sqloledb"
adoDbConn.Mode = adModeReadWrite
adoDbConn.Open "connection string data"
Ok, so I found out the error. For this particular case, the SQL query was wrongly defined, so no field DTMOUVEMEN was being set in the Adodc Recordset.