Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: LINQVB.NET
I am currently trying to understand as to why when I apply the following changes to the interface object that it does not get added to the changeset.
 
The following is a transaction which is looping through XML and setting the values to the object(Which is some kind of item-type)
    ' If Connection is Closed 
    ' Open before we get a Transaction 
    If DB.Connection.State = ConnectionState.Closed Then
        DB.Connection.Open()
    End If
 
    DB.Transaction = DB.Connection.BeginTransaction
 
    Try
        Dim nEl = 0
        For Each el As XElement In XDoc.Root.Elements
            Dim Type = el.Element("Type").Value.ToUpper
            Dim RefCode = el.Element("RefCode").Value.ToUpper
 
            Dim oIItem = GetItemByTypeAndCode(DB, Type, RefCode)
 
            If oIItem IsNot Nothing Then
                If Not el.Element("SP1").Value.IsNullOrEmpty Then
                    oIItem.ItmSelling1 = CDbl(el.Element("SP1").Value)
                End If
                If Not el.Element("SP2").Value.IsNullOrEmpty Then
                    oIItem.ItmSelling2 = CDbl(el.Element("SP2").Value)
                End If
                If Not el.Element("SP3").Value.IsNullOrEmpty Then
                    oIItem.ItmSelling3 = CDbl(el.Element("SP3").Value)
                End If
                If Not el.Element("SP4").Value.IsNullOrEmpty Then
                    oIItem.ItmSelling4 = CDbl(el.Element("SP4").Value)
                End If
                If Not el.Element("SP5").Value.IsNullOrEmpty Then
                    oIItem.ItmSelling5 = CDbl(el.Element("SP5").Value)
                End If
                If Not el.Element("SP6").Value.IsNullOrEmpty Then
                    oIItem.ItmSelling6 = CDbl(el.Element("SP6").Value)
                End If
                nEl += 1
 
                If ReportProgressDel IsNot Nothing Then
                    ReportProgressDel.Invoke(nEl / XDoc.Root.Elements.Count * 100)
                End If
            Else
                Throw New Exception("Item '{0}' of type {1} not found!", RefCode.Trim, Type.Trim)
            End If
        Next
 
        DB.SubmitChanges()
        DB.Transaction.Commit()
 
    Catch ex As Exception
        lError = True
        DB.Transaction.Rollback()
        Throw ex
    End Try
Posted 25-Feb-13 21:25pm
EnzeroX541

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 500
1 Tadit Dash 330
2 Sergey Alexandrovich Kryukov 250
3 OriginalGriff 163
4 Peter Leow 140
0 Sergey Alexandrovich Kryukov 9,435
1 OriginalGriff 5,498
2 Peter Leow 4,230
3 Maciej Los 3,540
4 Abhinav S 3,353


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid