473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Caching problem?

I'm writing vb.net code with MS Access as the database using
OleDbConnection. The problem I'm having is, I write to the database
then I read back what I just wrote. The read appears to be from an
older cached version because I get the previous results. If I read
twice I usually get the correct results. Any ideas on how to suppress
this?

thanks,

fg

Nov 13 '06 #1
2 1390
"FredG" <fg*****@gmail.comwrote in message
<11*********************@h48g2000cwc.googlegroups. com>:
I'm writing vb.net code with MS Access as the database using
OleDbConnection. The problem I'm having is, I write to the database
then I read back what I just wrote. The read appears to be from an
older cached version because I get the previous results. If I read
twice I usually get the correct results. Any ideas on how to
suppress this?

thanks,

fg
Technically, you are not using Access as database, but Jet ;-)

The behaviour is known when using ADO connection, and here is a
Microsoft KB article on that http://support.microsoft.com/kb/200300.
How or if this relates to .Net, I don't know. If you don't get any
ansvers, then I suggest trying an NG dedicated to VB.Net.

--
Roy-Vidar
Nov 13 '06 #2
Hi Fred,

Here is what I do to read from an Access MDB into a VB.Net app which
does not seem to have any issues:

Imports System.Data.OleDB

Public Class Form1
Private Button1_Click(...) handles Button1.Click
Dim Conn As New OleDBConnection("Provider=Microsoft.Jet.OLED.4.0;
Data Source="C:\test1.mdb;")
Dim da As New OleDbDataAdapter, ds As New Dataset
da.SelectCommand = New OleDbCommand
da.SelectCommand.Connection = conn
da.SelectCommand.CommandTye = CommandType.Text
da.SelectCommand.CommandText = "Select * from Table1"
da.Fill(ds, "tbl1")
dgrv1.DataSource = ds.Tables("tbl1")
End Sub
End Class

dgrv1 is a datagridview that I use to display the data from my test
table in the Access mdb called Table1. I alias this table in the VB.Net
app as "tbl1" (for distinguishing purposes). If you want to read back a
specific row, just change the commandText in the select command like

Select * from Table1 Where ID = 5

You could also use a straight forward command object instead of a
dataAdapter, but the dataAdapter has a lot more methods/properties built
into it than the command object. It encapsulates more stuff - like
dealing with apostrophes, particularly in parameters.

Regards,
Rich
*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hypo | last post by:
Im relatilvly new to a web programming in general, and here's the situation i have: I have a default page with dynamic content, and one button with onclick code something like this: { // do...
0
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. ...
3
by: Janaka | last post by:
Hi All, I'm having a problem with Page Output caching on a page that contains a DataGrid. Basically the page pulls up some data for sales information from the DB. Some of this has to be...
1
by: Leo Muller | last post by:
I am impressed by the caching performance of .NET. However, there is one major obstacle that I haven't managed to solve yet. What I want to do is the following: I have a normal site, and a...
8
by: tshad | last post by:
I am having a problem with IE on one machine where it will not work after the first time on certain pages. It appears to be going to the cache all the time. On other machines I don't have that...
2
by: lanem | last post by:
I am working on a ASP.NET 2.0 web site that has some PDFs that users can download. I'm using an HTTP module to see if the user has permission to view the PDF before loading it. This all works...
0
by: Jonaed | last post by:
Hello, I am having a problem with caching, or at least I think it is with caching. I have a simple <%= "text " + DateTime.Now.ToString() %> in one of my aspx files (that is included thru the...
3
by: Purti Malhotra | last post by:
Hi All, In our Web hosting environment we are using Virtual hosting i.e. multiple websites are on one server and multiple domains are pointing to a single website. Issue: We have two domains...
4
by: Hermann | last post by:
My site is a bit slow showing the main page so I thought caching query result in PHP will improve performace. Then I read MySQL documentation and saw that MySQL does have a caching feature. So......
2
by: Toni | last post by:
Hello! I'm trying to use ASP.NET caching with my web site and SQL Server, but I have a problem. I try to do everything according to the instructions like this page here:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.