473,463 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to use Begintransaction ?

Page_a.aspx.cs does a loop thru 7 days of the week. W/in the loop, it
makes a call to myService - a webservice - passing in a serialized objDay
(which represents the day's info). The webservice function deserializes
objDay and writes to the db.

Works great. Problem is if 1 of the 7 days fails to write, there's no
rollback functionality. I want it so that if a day doesn't write, none of
the days should write. BeginTransaction is a property of the transaction
object. But my transaction object exists only in the webservice, and that
webservice is killed and recalled every day of the 7 days of the week. So
there's no continuity there. Is there any way to get the rollback
functionality I'm looking for?

The only thing I can think of is somehow get objDay1, objDay2.....objDay7
and pass them ALL at one time to the webservice, which will then be able to
do all the transactions at once with a beginTransaction at the begining....
But this is more complex because actually, we don't always pass in 7 days.
Sometimes the user only modifies 3 days, in which case we only need to write
to the db 3 times.

Any ideas? Thanks
Jason Shohet
Nov 19 '05 #1
2 1792
If you are using web services and want transactional data, you will have to
throw all 7 at once. But, there are other options:

1. Put the days in a temporary table of some sort (not necessarily
#tableName type of temp table, but rather something you will clear out when
all of the data is there). You can then have the data migrated into the
normal structure when the 7th arrives (part of the stored procedure). Clear
out the table of bad records on a daily basis is an option for cleaning.

2. Compile the information into one stream of data and pass that to the web
method. You then control when the data is sent, which is "only when all 7
days are there".
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Jason Shohet" wrote:
Page_a.aspx.cs does a loop thru 7 days of the week. W/in the loop, it
makes a call to myService - a webservice - passing in a serialized objDay
(which represents the day's info). The webservice function deserializes
objDay and writes to the db.

Works great. Problem is if 1 of the 7 days fails to write, there's no
rollback functionality. I want it so that if a day doesn't write, none of
the days should write. BeginTransaction is a property of the transaction
object. But my transaction object exists only in the webservice, and that
webservice is killed and recalled every day of the 7 days of the week. So
there's no continuity there. Is there any way to get the rollback
functionality I'm looking for?

The only thing I can think of is somehow get objDay1, objDay2.....objDay7
and pass them ALL at one time to the webservice, which will then be able to
do all the transactions at once with a beginTransaction at the begining....
But this is more complex because actually, we don't always pass in 7 days.
Sometimes the user only modifies 3 days, in which case we only need to write
to the db 3 times.

Any ideas? Thanks
Jason Shohet

Nov 19 '05 #2
I like the idear of passing in 1 stream of data, with 1-7 day objects
(objDay) in there.
Problem is I don't know if its possible to somehow serialize all the objects
into 1 single string, and deserialize them back into 1 thru 7 individual
objects.

Perhaps a better way is to create our own XML file with nodes, intead of the
objDay objects. This would be much uglier to work with in code however.
The custom class objects are much more elegant....

Thanks again cowboy
Nov 19 '05 #3

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

Similar topics

0
by: Bjoern | last post by:
Hi, I'm using NHibernate in my .NET Application to access my DB2 8.1 PE. When I want to start a transaction i always get this error (see below). What I could figure out so far is that I have...
2
by: perspolis | last post by:
Hi all I have two class one master and another detail that connect to sql server database. and every class has a method name "BeginSave" that starts a transaction and "EndSave" method to commit...
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
1
by: Mana | last post by:
Hi, I want to implement nested transactions in C#. When I write BEGIN TRANSACTION inside another BEGIN TRANSACTION in an SQL Script it works fine. But when I call BeginTransaction() inside...
20
by: Mukesh | last post by:
Hi all, Consider this code SqlConnection oConn = new SqlConnection(AccountsConnectionString); SqlCommand cmdInsert = new SqlCommand("UpdateQuery"); //Location 1: //SqlTransaction sqlTran =...
3
by: Gordon | last post by:
I am currently working on some code for my CMS that creates a site folder, then creates all the necessary child folders inside it. The method that creates folders needs to insert into 2 tables so...
8
by: =?Utf-8?B?U2F2dm91bGlkaXMgSW9yZGFuaXM=?= | last post by:
Is it right when placing the RETURN statement inside the TRY or inside the CATCH statement, when there is a FINALLY clause? Especially when there is a transaction going on, in the try/catch block?...
1
by: Leon Mayne | last post by:
Hello, I had a chunk of code that would execute a stored proc to migrate data between two systems (takes a few minutes) and then performs some data manipulation on the migrated data. This was...
0
by: =?Utf-8?B?Q2hhbmUgRw==?= | last post by:
We recently updated our web service from .Net 1.1 to .Net 2.0. Our web services are using the Oracle Client provided by Microsoft. We are now randomly getting the following error when accessing...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...

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.