Solved

Where's my data???  (MS ACCESS, OLE DB, DataGrid)

Posted on 2006-07-21
4
267 Views
Last Modified: 2010-04-16
1.  I have a DataGrid.  
2.  I have a Form.
3.  I have an Access DB.
4.  I have a dataset.

The Form data is inserted into my DB in an isolated transaction.

After that transaction has completed, I reload my dataset which is binded to the DataGrid.  I use a  connection instance for me insert transaction, and another connection object for my "selects".  Even though both connection objects are created from the same connection string (appended below), the data seems to not be updated with a follow up my completed transaction with a search on the newly inserted data.

Basically the data I'm submitting is not show up in my datagrid.  It's like I have to wait a few seconds and search again to find it.  Is Access really that slow.  Why would it complete my insert and transaction if it's not done.




Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=$$$\DocuBase.mdb;Mode=Share Deny None;Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False
0
Comment
Question by:Tertioptus
  • 2
4 Comments
 
LVL 6

Expert Comment

by:NunoGodinho
ID: 17158630
Hi,

   Are you explicitly commiting the transaction? that could be the problem.
0
 
LVL 1

Accepted Solution

by:
flashaoy earned 500 total points
ID: 17159846
You'll have to use one instnce troughout your app(or form) of the adapter(adp1) and assosiated connection(con) when selecting, inserting, deleteing and updateing of the dataset(ds) if you want the data to be concurrent within your grid and reflect changes as it happens. The concurrency behind the dataset & grid are maintained by currencymanagers and currency happens 'automaticlly', but you'll have to use the original instances of dataset, adapter, commands and connections objects to preserve currency of the datasets and keep them in context of its original 'data factories'.

If you have 2 adapter; one for selecting and one for insetingon the same dataset table, you will have concurrency problems. Rember that the adapter knows the states of the rows during an fill or update - the adapter only gets/changes the rows whos states has changed and/or are different as those rows in the db.

you should buy a book explaning these stuff to you. Datasets are very powerfull, but they can irretate the hell out of you if you use it the wrong way.
0
 
LVL 5

Author Comment

by:Tertioptus
ID: 17167167
Oui, oui, Nuno
0
 
LVL 5

Author Comment

by:Tertioptus
ID: 17171162
Just needed to maintain one connection object.  Thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now