.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Insert Master/Detail data using ADO.net Transactions

Posted By:      Posted Date: September 04, 2010    Points: 0   Category :ASP.Net
I am working on Sales application. In database i have SalesOrderHeader & SalesOrderDetail tables. They are almost typical Adventureworks db tables.How to insert data in both tables using TransactionScope so if any of the record from the two tables generate error complete transaction roll-back.One thing more I am using TableAdapters, My initial concept was inserting record in SalesOrderHeader, get SalesOrderId using Scope_Identity & bulkInsert Records to SalesOrderDetail using TransactionScope.Please suggest.

View Complete Post

More Related Resource Links

Accessing master formview data from a nested detail formview?

Hi all, I would like to ask if it is possible to access data on a master FormView from a nested detail FormView. I have a main form (master) with several tabs (detail) and would like to display a label with text from main form that is hidden by the tab at the moment of editting. My asp page looks like this.<asp:FormView ID="fvwCustomer" runat="server" DataSourceID="dsCustomer" DefaultMode="Edit" DataKeyNames="CustomerID"> <EditItemTemplate> <asp:TextBox ID="CompanyTextBox" runat="server" Text='<%# Bind("Company") %>' /> <asp:FormView ID="fvwContactPerson" runat="server" DataSourceID="dsContactPerson" DefaultMode="Edit" DataKeyNames="ContactPersonID"> <EditItemTemplate> <%-- I need to get the value Company from dsCustomer --%> <asp:Label ID="CompanyTextLabel" runat="server" Text='<%# Eval("Company") %>' /> </EditItemTemplate> </asp:FormView> </EditItemTemplate> </asp:FormView>   Is it possible to get the value of the label CompanyTextLabel from CompanyTextBox using just ASP.NET expressions or something similar without writing c# code in

Insert page with master/detail


I have a case where I want to insert personal data and on the same page to be able to insert contact information, meaning entering more than one contact like e-mail,phone no ect. and contact data are saved to another table(it's like saving order info and order details at the same time)

is there a way to build this kind of page using dynamic data.

any link to an example would be very helpful


How to output data from master detail tables into text file but on different lines.



I have a requirement to output data from two tables, a master table and a detail table, to a text file such that the output looks like the following:

master record 1

detail record  1 1

detail record   1 2

master record 2

detail record  2 1

master record 3

detail record 3 1

detail record 3 2

detail record 3 3



Is this possible in one query?  I am sufficiently familiar with the bcp utility to do the output from any of the tables separately but have some difficulty with doing it for the two tables and have the result structured as outlined above.

Master-Detail with the GridView, DetailsView and jQuery's ThickBox

One more article about grids from Matt Berseth. This time he shows how to create master-detail with the gridview, detailsview and jQuery's ThickBox. He writes:
So I thought I would check some of this out and along the way rebuild my Master-Detail with the GridView, DetailView and ModalPopup Controls and replace the ModalPopup with jQuery's ThickBox. I found it pretty interesting - read on to see how it went

GridView inline Master/Detail record display

This code drop is part of a smash and grab series. If you're in a rush, you can just grab this code and insert it into your application, no understanding is required. When you have some time (ya, right) you may want to review the source code.

Master-Detail with the GridView, DetailView and jQuery's ThickBox

An example of using the jQuery ThickBox with ASP.NET's GridView and DetailView controls

GridView control to show master-child or master-slave data, written in c#, asp.net

I previously made a master slave datagrid using Visual Studio 2003 .Net (original article) that would allow users to show data to clients using collapse and expand features. These features however did not carry over to gridview for many users. This tutorial will explaing how to create a collapsable/expandable gridview in frameworks 2.0 and higher

Insert data to Excel using OLEDB



I am trying to insert data to Excel Document using OLEDB as follows:-

 sql = "Insert into [MyFirstSheet$] (" + Title1 + "," +Title2 + "," + Title3 + ") 
values('" + Value1 + "','" + Value2 + "','" + Value2 + "')";
myCommand.CommandText = sql;

 sql = "Insert into [MyFirstSheet$] (" + Title1 + "," +Title2 + "," + Title3 + ") 

values('" + Value1 + "','" + Value2 + "','" + Value2 + "')";

myCommand.CommandText = sql;


But, the Title1 ,Title2, Title3 are in the 3rd row of the Excel Document. So, the data is not inserted.

Cutting Edge: Master-Detail Views with the ASP.NET Ajax Library


When you think of data-driven Web pages, most of the time what you really have in mind is a master-detail view of some cross-related data. Dino builds an example with ASP.NET AJAX 4 and jQuery.

Dino Esposito

MSDN Magazine January 2010

Transactions: Build Scalable Systems That Handle Failure Without Losing Data


Systems that handle failure without losing data are elusive. Learn how to achieve systems that are both scalable and robust.

Udi Dahan

MSDN Magazine July 2008

Data Points: Revisiting System.Transactions


The System.Transactions namespace of the Microsoft .NET Framework makes handling transactions much simpler than previous techniques. Read all about it this month.

John Papa

MSDN Magazine November 2006

Data Points: ADO.NET and System.Transactions


The Microsoft® . NET Framework versions 1. 0 and 1. 1 represented major changes in software development. However, one important thing that did not change much was support for distributed transactions.

John Papa

MSDN Magazine February 2005

insert the data in database using gridview jquery



I want to use gridview and bind the data and after i want insert the data in database using jquery,

below the link i got for delete


but i want the sample example for insert  row from gridivew and add the database.


Insert data based on gridview user value on row.. how to



I have three column comes from database table(Table1) and one column is for entering data for the user let us consider it look like this 

ItemNo ItemName Qty  uservalue

001       A               50       20

002       A               20       5

003       B               50  

004       C               60      10

005       D               40 

006       E               90      15 


If its 300 row from database to gridview it will show 50 record with page navigation..

What i need is i need to insert data in to database table which gridview row has user value..

The output of the another table(Table2) will look like this after insert

ItemNo ItemName   uservalue

001       A                    20

002       A                      5  

review, edit and insert data using 2 diffrent database



is it possible to create a custom list in sharepoint designer to enter a vacation request and using a work flow that goes to the HR department. but when the HR department approve the request the HR can store these requested data into another database?

what i mean is, the employee fill a form in to request some vacation days using a custom list in my wss3 site. i assume that these data will be stored in the WSS_content database. now when the HR department get this filled form they have to store the data of the form in to a database but not in the WSS_Content database.

is this possible?

Insert Excel Data via File Upload into sql server database???

Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

reading xml data and insert into database table

hi friends, .very urgent for me so only i send following script i create for read xml data and to import to table. i got result for reading xml and rows are added to table but the values are showing null pls clarify this problem. thanks alter procedure pizza_sales ( @xml xml ) as begin INSERT INTO pizza_xml (LOC_CODE, CUST_CODE, PRODUCT_ID, INV_TYPE, INV_NO, INV_DT, INV_QTY_IN_INV_UOM, INV_RATE_IN_BS_CURR, INV_VU_IN_INV_CURR, -- TOTAL_DISC_IN_BS_CURR, NET_INV_VU_IN_INV_CURR, NET_INV_VU_IN_BS_CURR, TOTAL_TXES_IN_BS_CURR ) select table1.column1.value('@LOC_CODE','nvarchar(75)'), table1.column1.value('@CUST_CODE','nvarchar(75)'), table1.column1.value('@PROD_CODE','nvarchar(75)'), table1.column1.value('@INV_TYPE','nvarchar(50)'), table1.column1.value('@INV_NO','nvarchar(100)'), table1.column1.value('@INV_DT','datetime'), table1.column1.value('@INV_QTY_IN_INV_UOM','numeric(28,8)'), table1.column1.value('@INV_RATE_IN_BS_CURR','numeric(28,8)'), table1.column1.value('@INV_VU_IN_INV_CURR','numeric(28,8)'), --table1.column1.value('@TOTAL_DISC_IN_BS_CURR','numeric(28,8)'), table1.column1.value('@NET_INV_VU_IN_INV_CURR','numeric(28,8)'), table1.column1.value('@NET_INV_VU_IN_BS_CURR','numeric(28,8)'), table1.column1.value('@TOTAL_TXES_IN_BS_CURR','numeric(28,8)') from @xml.nodes('pizza/pizzaxml')as table1(column1) end declare @id
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend