Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 19th, 2007, 08:39 PM
Kia Kia is offline
Authorized User
 
Join Date: Jun 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Record Locking & Transactions in Strongly Typed DS

Hi,

I have a form with 4 tables displayed in different tabs, all coming from the same dataset. Here's part of the Form.Load event so you know what I mean:

Code:
Me.taPaymentsApplied.Fill(Me.DsPaymentProcessing.PAYMENT_APPLIED)
Me.taNewPayment.Fill(Me.DsPaymentProcessing.PAYMENT, Me.txtCardID.Text)
Me.taExistingPayment.Fill(Me.DsPaymentProcessing.EXISTING_PAYMENT, Me.txtCardID.Text)
Me.taInvoices.Fill(Me.DsPaymentProcessing.INVOICE, Me.txtCardID.Text)
What I need to do is lock all the records that are opened in the latter 3 lines and begin a transaction. Then allow the user with the lock to add records to the first table and modify contents of the next 3. I'd prefer that other users simply not be allowed to even view these locked records.

Saving needs to be in a transaction, meaning either save ALL 4 tables or fail on all.

I can do this when I do everything programmatically, but I'm a bit lost when it comes to using objects from my Datasource window.

I'd appreciate any help.
Cheers

Kia
 
Old June 29th, 2007, 06:34 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

dataset is all client side...so u cannot lock database rows using dataset...
place an explicit lock using transaction before u fetch the data...and commit / rollback it after modification

 
Old June 29th, 2007, 06:34 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

and use IsolationLevel according to ur requirement

 
Old July 2nd, 2007, 09:32 PM
Kia Kia is offline
Authorized User
 
Join Date: Jun 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I keep seeing a little bit of code to extend the TableAdapter namespace and add a transaction sub to it. This is the code I saw on someone's blog

Namespace MyDataSetTableAdapters
    Partial Class MyTableAdapter
        Public Sub SetTransaction(ByVal trn As SqlClient.SqlTransaction)
            Me.Adapter.InsertCommand.Transaction = trn
            Me.Adapter.UpdateCommand.Transaction = trn
            Me.Adapter.DeleteCommand.Transaction = trn
            Me.Adapter.SelectCommand.Transaction = trn
        End Sub
    End Class
End Namespace

What I don't get is, what do you do with this? Where to put it? the only place I can figure out is the dataset's designed code, but it would get overwritten I thought. Enywhere else, I get an issue with the "Adapter" class not defined.
 
Old July 23rd, 2007, 06:23 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

i hv not worked on TableAdapters and Update Method
i always use Command object & SQL statements for Insert, Update & Delete tasks







Similar Threads
Thread Thread Starter Forum Replies Last Post
strongly-typed DataSet.Rows r n't getting Updated srkvellanki ASP.NET 2.0 Professional 3 October 1st, 2008 05:26 PM
"Strongly typed" roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 26th, 2008 10:35 AM
Sorting Gridview bound to strongly typed object kulkarnimonica ASP.NET 2.0 Professional 10 September 20th, 2007 03:32 PM
Accessing Strongly Typed Session Data Woodman ASP.NET 2.0 Professional 2 March 9th, 2007 04:42 PM
Crystal Report and Strongly-Typed dataset jaucourt Crystal Reports 1 February 9th, 2004 07:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.