Skip to content

Instantly share code, notes, and snippets.

@nathvi
nathvi / NonqueryExecute.cs
Created August 3, 2018 14:51
Non query execute.
public static int NonqueryExecute(this SqlConnection sqlConnection, string sqlCommandText)
{
int returnValue = 0;
try
{
SqlCommand cmd = sqlConnection.CreateCommand();
SqlTransaction transaction = sqlConnection.BeginTransaction(Guid.NewGuid().ToString().Substring(0, 7));
cmd.Connection = sqlConnection;
cmd.Transaction = transaction;
cmd.CommandText = sqlCommandText;
public class TreeNode
{
readonly List<TreeNode> ChildNodes = new List<TreeNode>();
public string Id { get; }
public TreeNode(IEnumerable<TreeNode> childNodes, string id)
{
Id = id;
if(childNodes != null)
{
public class BinaryTreeNode
{
public BinaryTreeNode Left { get; set; }
public BinaryTreeNode Right { get; set; }
public string Id { get; }
public BinaryTreeNode(string id, BinaryTreeNode left, BinaryTreeNode right)
{
Left = left;
Right = right;