Newsgroup: it.comp.lang.visual-basic
Titolo: ?[vb6] collegamento ado - access 2000 e datagrid

allora.
io collego un adodc ad un database di sql server, ed una datagrid
all'oggetto adodc. questo funziona e mi mostra tutti i record sia con
cursore lato client che lato server.
il problema nasce quando attacco l'adodc ad un db access 2000:
se utilizzo il lato server, l'adocd si riempie con i dati , ma la
datagrid resta vuota. il fatto è che a me serve avere il cursore lato
client
grazie
Daniele



prelevato direttamente da MSDN
****************************************************************************
PRB: DataGrid Not Populated Using Jet.OLEDB.4.0 Provider and ADO Server
Side Cursor
ID: Q224192
--------------------------------------------------------------------------------
The information in this article applies to:
ActiveX Data Objects (ADO), versions 2.0, 2.01, 2.1
Microsoft Visual Basic Learning, Professional, and Enterprise Editions
for Windows, versions 5.0, 6.0
--------------------------------------------------------------------------------
SYMPTOMS
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.
CAUSE
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.
RESOLUTION
Set the RecordsetObject.Properties("IRowsetIdentity")= true before
opening the recordset.
MORE INFORMATION
Steps to Reproduce Behavior
Open a new standard Visual Basic project. Form1 is created by default.
In Project/References, set a reference to Microsoft ActiveX Data Objects
2.x Library.
Drag an ADO Data Control and a DataGrid onto Form1. These can be added
from Project/Components.
Cut and paste the following code into the General Declarations section:
Dim cn AS ADODB.Connection
Dim rs as ADODB.Recordset
Cut and paste the following code into the Form_Load Subroutine: (You
might need to change the path to NWind database in the strConn variable.)
    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
Run the project. You should not see any data displayed in the DataGrid.
Remove the comment from the code line:
.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
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
****************************************************************************
ciao a tutti
Daniele
