PRB: DataGrid Not Populated Using Jet.OLEDB.4.0 Provider and ADO Server Side CursorID: Q224192
|
When using the Microsoft.Jet.OLEDB.4.0 Provider and an ADO Server side cursor bound to the DataGrid (either through the ADO DataControl or directly to the grid), the data does not display in the DataGrid.
The Microsoft.Jet.OLEDB.4.0 Provider does not support the DBPROP_LITERALIDENTITY property, so the provider then needs to implement IRowsetIdentity. ADO should set this property before opening the rowset. If you ask for an interface (such as IRowsetIdentity), and OLE DB has not opened the rowset to support it, you will get the E_NOINTERFACE error back even if the provider supports it.
Set the RecordsetObject.Properties("IRowsetIdentity")= true before opening the recordset.
Dim cn AS ADODB.Connection
Dim rs as ADODB.Recordset
Dim strConn As String
Dim stcnQL As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\Nwind.mdb;"
Set cn = New ADODB.Connection
cn.Open strConn
stcnQL = "SELECT * FROM customers"
Set rs = New ADODB.Recordset
With rs
.ActiveConnection = cn
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
' .Properties("IRowsetIdentity") = True 'remove comment to display data
.Open stcnQL, , , , adCmdText
End With
Set Adodc1.Recordset = rs
Set DataGrid1.DataSource = Adodc1.Recordset
.Properties("IRowsetIdentity")=True
The data should now display in the DataGrid.Additional query words: empty
Keywords : kbADO kbOLEDB kbVBp kbVBp500 kbVBp600 kbGrpVBDB
Version : WINDOWS:2.0,2.01,2.1,5.0,6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: June 1, 1999