Search This Blog

Thursday, April 4, 2013

PlusMinus buttons visible RadTreeview Telerik

Telerik > Windows Forms > PlusMinus buttons visible RadTreeview Telerik

ExpanderElement: Gets the property grid item expander element.

Example: PlusMinus buttons visible RadTreeview Telerik 

Private Sub tv_NodeFormatting(sender As System.Object, e As Telerik.WinControls.UI.TreeNodeFormattingEventArgs) Handles tvArbore.NodeFormatting

If e.Node.BackColor.Name <> "LightBlue" Then
     e.NodeElement.ExpanderElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden
Else
     e.NodeElement.ExpanderElement.Visibility = Telerik.WinControls.ElementVisibility.Visible
End If

End Sub

 





Tuesday, April 2, 2013

Finding columns of SQL Server temporary table

SQL Server > Catalog Views > sys.columns

Retrieve info about columns of an object that has columns,.

Example

Finding columns of SQL Server temporary table

select
  *
FROM
  tempdb.sys.columns
WHERE
 [object_id] = OBJECT_ID('tempdb..##MyGlobalTemp')





SUBSTRING SQL Server

SQL Server > Built-in Functions > Substring

SUBSTRING SQL Server returns part of a string

Syntax:

SUBSTRING ( expression ,start , length )

Example:

declare @str varchar(10) = '08.12.2013'
select substring(@str,1,2) as day, substring(@str,4,2) as month, substring(@str,7,4) as year

Result:
day month year
08  12    2013






DROP TABLE SQL Server

SQL Server > DDL > Drop > Table

Removes table definitions and data, indexes, triggers, constraints, and permissions for that table.

Example:

1. Simple drop
    DROP TABLE table_name

2. Drop temporary table and tests for its existence before

  if object_id('tempdb.dbo.##MyGlobalTemp1') Is Not Null
    DROP TABLE ##MyGlobalTemp1





Friday, March 29, 2013

PadLeft and PadRight C#

C# > StringPadRight & PadLeft

PadRight left aligns the characters in this string, padding on the right with a specified Unicode character.
PadLeft right aligns the characters in this string, padding on the lefy with a specified Unicode character.

Example:

string str = "four";
char pad = '.';
string str2 = str.PadLeft(7, pad); // "...four"
string str3 = str.PadRight(7, pad); //"four..."





StartWith string C#

C# > String > Methods > StartWith

StartWith determines whether the beginning of  a string matches the specified value.

string str = "--comment--";
if (str.StartsWith("--"))
   str = "comment";




String.Join Method C#

C# > String > Join

Join concatenates a specified separator string between each element of a specified String array.

Example


String[] str = { "red","green","blue","yellow" };
String sep = ",";
String result = String.Join(sep, str, 0, 4); // "red,green,blue,yellow"