Re: VB.NET ADO Recordset DataGridView and Access not in sync w/oth



Thanks much, I agree. I started rewriting it last nite before I saw your
post. In fact, I had it mostly written in ADO.NET BEFORE I decided Recordset
would be simpler. Oh well, thanks for the push...

"Bob Barrows [MVP]" wrote:

Jim Crist wrote:
I have a very small, simple database in Access. I have it bound to a
DataGridView in VB.NET. I can add, change and delete records via the
DataGridView, and the changes are reflected in Access. A different
section of code (aka Checking Code) reads the database and under
certain conditions it will change a field in the database. I thought
everything was working pretty well, until I realized that changes
made via the DataGridView weren't being detected by the Checking Code.

Since this is a simple database, I opted to use a ADO.NET RecordSet:

That's an oxymoron: ADO.Net does not have a recordset object. You are using
a classic COM ADODB connection and recordset via Interop, and there really
is no reason to be doing so, simple database or otherwise. You're in the
..Net world so stick with the .Net objects: use an oledatareader to retrieve
data, and an olecommand object to perform your updates (it is usually bad
practice to maintain data with a cursor - DML SQL - update, insert and
delete, is so much more efficient) so you don't have to open another
connection to the database. You are preventing session pooling from working
to your best advantage by doing using different connections.

What you are undoubtedly falling victim to is Jet's delayed-write
optimization. Jet caches writes to the database for some period of time to
improve performance. See
http://support.microsoft.com/kb/200300
and (not so relevant, but illuminating):
http://support.microsoft.com/?kbid=240317

Having said all that, I do need to include my canned reply (your question
partially concerned ADODB which is ontopic here so it fell into a gray
area):

There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic ADO newsgroup. ADO.Net bears
very little resemblance to classic ADO so, while you may be lucky enough to
find a dotnet-knowledgeable person here who can answer your question, you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.adonet.



--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



.



Relevant Pages

  • Re: VBA - "Out of stack space" error
    ... written for AutoCAD VBA generates an 'Out of stack space' ... I create the ADODB connection... ... > ' If the connection to the database has been opened ... where I try to open the recordset. ...
    (microsoft.public.vb.database.ado)
  • Re: adodb
    ... without knowing how the database is implemented. ... required to access a database when using ADO, although one can use ADO to ... A Connection object represents a unique session with a data source. ... A Recordset object represents the entire set of records from a base table ...
    (microsoft.public.vb.database.ado)
  • Re: adodb
    ... > without knowing how the database is implemented. ... > required to access a database when using ADO, although one can use ADO to ... > A Connection object represents a unique session with a data source. ... At any time, the Recordset object ...
    (microsoft.public.vb.database.ado)
  • Re: strange slowness with getrows method
    ... how many fields in the recordset? ... Can you try using the native OLEDB provider for your database rather than ... I notice that you are using the bad practice of supplying a connection ... > table to use the more efficient getrows method. ...
    (microsoft.public.inetserver.asp.db)
  • Re: WSS 3.0 Sites DOWN ( again by Microsoft update??)
    ... Please only post one particular question to ONE newsgroup to avoid ... database 'WSS_AdminContent' is full. ... Wanna to manage the DB thru Microsoft SQL server mamagement stuio. ... An error has occurred while establishing a connection to the server. ...
    (microsoft.public.sharepoint.windowsservices)