git fetch origin branchName
git checkout branchName
Per fare Merge dal master al branch attuale:
git pull
git merge origin master
git pull
git merge origin master
ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
true
Class CreateTreeViewFromDataTable
' This Dictionary will identify each List<TreeNode>
' And the List<TreeNode> will restore the all TreeNode from a same parentNode
Private Shared dic As Dictionary(Of Integer, List(Of TreeNode))
Public Shared Sub BuildTree(ByVal dt As DataTable, ByVal treeView As TreeView, ByVal expandAll As [Boolean], ByVal displayName As String, ByVal nodeId As String, ByVal parentId As String)
' Clear the TreeView if there are another datas in this TreeView
treeView.Nodes.Clear()
dic = New Dictionary(Of Integer, List(Of TreeNode))()
Dim node As TreeNode = Nothing
For Each row As DataRow In dt.Rows
' Restore each record into a TreeNode
node = New TreeNode(row(displayName).ToString())
node.Tag = row(nodeId)
node.BackColor = Color.FromArgb(row("Colore"))
' The parentId of the TreeView's root is "" in the DataTable
' So if the parentId is a "", then it is the root
' Otherwise it is only a common TreeNode
If row(parentId).ToString() <> "0" Then
Dim _parentId As Integer = Convert.ToInt32(row(parentId))
' If there's exists a List<TreeNode> was identified by this _parentId
' Then we need put this node into this identified List<TreeNode>
If dic.ContainsKey(_parentId) Then
dic(_parentId).Add(node)
Else
' Otherwise
' We will Add a new record into the Dictionary<int, List<TreeNode>>
dic.Add(_parentId, New List(Of TreeNode)())
' Then put this node into the new List<TreeNode>
dic(_parentId).Add(node)
End If
Else
' Take this node into the place of the TreeView's root
node.NodeFont = New Font(treeView.Font, FontStyle.Bold)
node.BackColor = Color.FromArgb(row("Colore"))
node.Text = "[" & row("DesSpeciale") & "]" & vbTab & vbTab & node.Text
treeView.Nodes.Add(node)
End If
Next
' After collect and identify each collection with their parentId
' We will go on building this tree with the founded root node
SearchChildNodes(treeView.Nodes(0))
If expandAll Then
' Expand the TreeView
treeView.ExpandAll()
End If
End Sub
Private Shared Sub SearchChildNodes(ByVal parentNode As TreeNode)
If Not dic.ContainsKey(Convert.ToInt32(parentNode.Tag)) Then
' If there's no a identified collection by this parentId
' We will do nothing and return directly
Return
End If
' Put the identified collection by this parentId into the tree as this node's children
parentNode.Nodes.AddRange(dic(Convert.ToInt32(parentNode.Tag)).ToArray())
' See these children nodes as parent nodes
For Each _parentNode As TreeNode In dic(Convert.ToInt32(parentNode.Tag)).ToArray()
' Then go to find the identified collection by these id
SearchChildNodes(_parentNode)
Next
End Sub
End Class
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i
Con questa procedura è possibile intercettare un particolare errore (in questo caso un Deadlock), e rieseguire la procedura richiesta, per un determinato numero di volte (per evitare un loop)
DECLARE @RetryCounter INT
SET @RetryCounter = 1
RETRY: -- Label RETRY
BEGIN TRANSACTION
BEGIN TRY
UPDATE Customer SET LastName = 'John' WHERE CustomerId=111
COMMIT TRANSACTION
END TRY
BEGIN CATCH
PRINT 'Rollback Transaction'
ROLLBACK TRANSACTION
DECLARE @DoRetry bit; -- Whether to Retry transaction or not
DECLARE @ErrorMessage varchar(500)
SET @doRetry = 0;
SET @ErrorMessage = ERROR_MESSAGE()
IF ERROR_NUMBER() = 1205 -- Deadlock Error Number
BEGIN
SET @doRetry = 1; -- Set @doRetry to 1 only for Deadlock
END
IF @DoRetry = 1
BEGIN
SET @RetryCounter = @RetryCounter + 1 -- Increment Retry Counter By one
IF (@RetryCounter > 3) -- Check whether Retry Counter reached to 3
BEGIN
RAISERROR(@ErrorMessage, 18, 1) -- Raise Error Message if
-- still deadlock occurred after three retries
END
ELSE
BEGIN
WAITFOR DELAY '00:00:00.05' -- Wait for 5 ms
GOTO RETRY -- Go to Label RETRY
END
END
ELSE
BEGIN
RAISERROR(@ErrorMessage, 18, 1)
END
END CATCH