473,785 Members | 3,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using ADO.NET in a Connected not Disconnected Fashion

The ADO.NET DataSet is idea for application development, especially if you
need disconnected data. DataReader objects are great in the connected
environment but are forward only. What do you do when you want a connected
application but need the ability scroll forward and backward within the
result set.

What I'm trying to achieve is to build an application that has navigation
buttons, thus allowing the user to step forward or backward within a table.
If I use a DataSet the information is cached locally within the DataSet, but
changes to the data on the server are not reflected instantly unless the
user refreshes the data.

The alternative is to use a DataReader, but this only allows stepping
through records in a forward only direction.

What tools or techniques exist to allow two apps to step through records in
any direction, but if user A makes a data change User B sees that change as
soon as they get to the record when they reach it via a move next operation.

Any tips, techniques or articles gratefully received.

Steve
Nov 16 '05 #1
4 2320
As you rightly pointed out, the model has changed so that this is no longer
possible. In fact, i'd argue that code like that just should not be written
anymore because it defeats the purpose of the architecture. However, the
model is flexible enough so that you can program around the obstacle.

One approach is to catch the update to the dataset via an event and then
immediately turn around and fire the update to the underlying datastore. You
can either catch the event or call the dataset.getchan ges() function to
retrieve the changed rows.

You do see the problem though? This is not a scalable approach because it
creates too much traffic in high concurrency situations.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Steve Le Monnier" <st*********@ho tmail.com.nospa m.com> wrote in message
news:OH******** *****@TK2MSFTNG P15.phx.gbl...
The ADO.NET DataSet is idea for application development, especially if you
need disconnected data. DataReader objects are great in the connected
environment but are forward only. What do you do when you want a connected
application but need the ability scroll forward and backward within the
result set.

What I'm trying to achieve is to build an application that has navigation
buttons, thus allowing the user to step forward or backward within a
table. If I use a DataSet the information is cached locally within the
DataSet, but changes to the data on the server are not reflected instantly
unless the user refreshes the data.

The alternative is to use a DataReader, but this only allows stepping
through records in a forward only direction.

What tools or techniques exist to allow two apps to step through records
in any direction, but if user A makes a data change User B sees that
change as soon as they get to the record when they reach it via a move
next operation.

Any tips, techniques or articles gratefully received.

Steve

Nov 16 '05 #2
Thanks Alvin

I've played with the GetChanges on DataSets (which is really cool) and this
helps ensure my local DataSet being used by User A is updated, the problem I
have is that User B with their DataSet is totally unaware that the
information they are stepping through is now out of data, as they are
steping through a locally cached DataSet.

How do I allow users to step forward and backward through data, but ensure
all users see the very most recent data available.

Cheers

Steve

"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:OJ******** *****@tk2msftng p13.phx.gbl...
As you rightly pointed out, the model has changed so that this is no
longer possible. In fact, i'd argue that code like that just should not be
written anymore because it defeats the purpose of the architecture.
However, the model is flexible enough so that you can program around the
obstacle.

One approach is to catch the update to the dataset via an event and then
immediately turn around and fire the update to the underlying datastore.
You can either catch the event or call the dataset.getchan ges() function
to retrieve the changed rows.

You do see the problem though? This is not a scalable approach because it
creates too much traffic in high concurrency situations.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Steve Le Monnier" <st*********@ho tmail.com.nospa m.com> wrote in message
news:OH******** *****@TK2MSFTNG P15.phx.gbl...
The ADO.NET DataSet is idea for application development, especially if
you need disconnected data. DataReader objects are great in the connected
environment but are forward only. What do you do when you want a
connected application but need the ability scroll forward and backward
within the result set.

What I'm trying to achieve is to build an application that has navigation
buttons, thus allowing the user to step forward or backward within a
table. If I use a DataSet the information is cached locally within the
DataSet, but changes to the data on the server are not reflected
instantly unless the user refreshes the data.

The alternative is to use a DataReader, but this only allows stepping
through records in a forward only direction.

What tools or techniques exist to allow two apps to step through records
in any direction, but if user A makes a data change User B sees that
change as soon as they get to the record when they reach it via a move
next operation.

Any tips, techniques or articles gratefully received.

Steve


Nov 16 '05 #3
There are a couple of patterns for this. One centers around having user B
actually update the stale data. At that point, you indicate to the user that
rows 5, 6, 8 have been changed, display the changes and ask the user if they
want to proceed with the requested change.

Another approach is the bury-your-head-in-the-sand approach. Let the user
update the stale data since the premise is that fresh data is going to be
inserted anyway.

you can also set a global flag whenever you update the datasource. If the
flag is dirty, you discard the contents of the dataset ( it means that a
user updated) and pull data from the datasource instead for all users
requesting data, then reset the flag.

Another pattern involves writing a database trigger that writes a file when
rows are inserted to the database. Then, you set a cache dependency on the
file to reload the cache with a new dataset. They each have their
disadvantages.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Steve Le Monnier" <st*********@ho tmail.com.nospa m.com> wrote in message
news:Ol******** ******@TK2MSFTN GP15.phx.gbl...
Thanks Alvin

I've played with the GetChanges on DataSets (which is really cool) and
this helps ensure my local DataSet being used by User A is updated, the
problem I have is that User B with their DataSet is totally unaware that
the information they are stepping through is now out of data, as they are
steping through a locally cached DataSet.

How do I allow users to step forward and backward through data, but ensure
all users see the very most recent data available.

Cheers

Steve

"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:OJ******** *****@tk2msftng p13.phx.gbl...
As you rightly pointed out, the model has changed so that this is no
longer possible. In fact, i'd argue that code like that just should not
be written anymore because it defeats the purpose of the architecture.
However, the model is flexible enough so that you can program around the
obstacle.

One approach is to catch the update to the dataset via an event and then
immediately turn around and fire the update to the underlying datastore.
You can either catch the event or call the dataset.getchan ges() function
to retrieve the changed rows.

You do see the problem though? This is not a scalable approach because it
creates too much traffic in high concurrency situations.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Steve Le Monnier" <st*********@ho tmail.com.nospa m.com> wrote in message
news:OH******** *****@TK2MSFTNG P15.phx.gbl...
The ADO.NET DataSet is idea for application development, especially if
you need disconnected data. DataReader objects are great in the
connected environment but are forward only. What do you do when you want
a connected application but need the ability scroll forward and backward
within the result set.

What I'm trying to achieve is to build an application that has
navigation buttons, thus allowing the user to step forward or backward
within a table. If I use a DataSet the information is cached locally
within the DataSet, but changes to the data on the server are not
reflected instantly unless the user refreshes the data.

The alternative is to use a DataReader, but this only allows stepping
through records in a forward only direction.

What tools or techniques exist to allow two apps to step through records
in any direction, but if user A makes a data change User B sees that
change as soon as they get to the record when they reach it via a move
next operation.

Any tips, techniques or articles gratefully received.

Steve



Nov 16 '05 #4
Thanks Alvin

I'm going to spend some time research the possibility of having a database
flag which will indicate how old the data in each table is, Using the
SQLHelper execute scalar method I should be able to retrieve this flag or
time value efficiently and then update the local dataset(s).

This seems the best way of resolving my problem... many thanks for the idea.

Cheers

Steve
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:ef******** ******@TK2MSFTN GP14.phx.gbl...
There are a couple of patterns for this. One centers around having user B
actually update the stale data. At that point, you indicate to the user
that rows 5, 6, 8 have been changed, display the changes and ask the user
if they want to proceed with the requested change.

Another approach is the bury-your-head-in-the-sand approach. Let the user
update the stale data since the premise is that fresh data is going to be
inserted anyway.

you can also set a global flag whenever you update the datasource. If the
flag is dirty, you discard the contents of the dataset ( it means that a
user updated) and pull data from the datasource instead for all users
requesting data, then reset the flag.

Another pattern involves writing a database trigger that writes a file
when rows are inserted to the database. Then, you set a cache dependency
on the file to reload the cache with a new dataset. They each have their
disadvantages.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------

Nov 16 '05 #5

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

Similar topics

0
4566
by: John Lucas | last post by:
I have been reading many of the posts about determining which network card to use (in a machine with multiple nics), and determining whether or not that card is active. I'm hoping this will help others who are struggling with the same issues. This info exists in the groups, but not all in the same place. Thanks to everyone who contributes. Well done! Consider the following code:
2
2319
by: Robert Scheer | last post by:
Hi. My site needs to know if the user is connected before executing some queries on my database. Actually, I have a page loaded by an Iframe that runs every 30 seconds and updates a field on my database to tells me the user is connected. If this field is not updated for more than one minute I consider the user disconnected. The problem is, if that page does not load for any anormal reason (an IIS error like Page Could not be Loaded,...
9
1825
by: Steven Nagy | last post by:
I know that .NET is based on a disconnected architecture, but I can't conceive of why continually opening and closing a connection would be faster than leaving a connection open. So I ran a test and came up with a result of exactly the same times! 50 rows selected into a datareader, in a loop of 50 One opens and closes the connection in each iteration of the loop, the other just opens before the loop starts, then closes after the loop is...
5
1831
by: Julian | last post by:
I need to update 4 fields of a 20-field table. The table has no primary key. I need to cycle thru each of the four fields for each record to manipulate the data before writing it to the DB. In VB6, we used recordsets which were always connected to the DB, but for some strange reason, MS decided to implement unattached data objects (DataAdapter & DataSet). So how can I update my table above? -- |
1
15637
by: verge | last post by:
hello everyone! how's it going? like everyone in here im in need of some help and good friendship along the way...take a look at this: //MODIFIED SO IT DEALS WITH WINDOWS FTP USING ACTIVE CONNECTION //IMPORTANT: the logic is NOT complete, the program works only once and disconnects or freeze //One needs to modify or rewrite the program so it is fully functional for LIST and RETR
7
16944
by: semedao | last post by:
Hi all, I view many posts about this issue , the connected property does not tell us the current status of the socket. based on couple of suggestions of msdn , and some article here , I try to write an helper method that will tell if the socket is connected or not , but it's not working good continue to tell me that the socket is connectedeven if the other party already call shutdown(both) + close , or , even if the other party close the...
0
4926
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I want to call RDP on Page load and it is working fine.My code is in C#. But I am unable to perform following functions 1. when i disconnected from RDP, i want to go back to previous page 2. If RDP is opened in fullscreen mode, then onconnected, i want to go back to previous page.
2
3334
by: Gabriel | last post by:
Hello, I'm looking for documentation with "Best Practice" for ASP.NET application In which case use Connected or Disconnected mode Typed dataset or not ? I didn'd find anything pertinent ....
4
15306
by: keithseah | last post by:
Hi all, i've been having this problem and its kiiling me! i'm a newbie at this so i hope someone would be able to help me. picture link: http://i98.photobucket.com/albums/l272/rachelyeo/ErrorWebApplication2.jpg this pops up whenever i click on the Disconnect button after i have connected. these are the following codes for the program.
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.