C# > String class
Represents text as a series of Unicode characters.
Examples
Search This Blog
Monday, February 3, 2014
LEFT SQL Server Example
SQL Server > Built-in Functions > LEFT
Returns the left part of a string with the specified number of characters.
Example:
declare @str nvarchar(max)
set @str='SQL Server'
select left(@str,3)
result:
SQL
Returns the left part of a string with the specified number of characters.
Example:
declare @str nvarchar(max)
set @str='SQL Server'
select left(@str,3)
result:
SQL
Etichete:
SQL Server
LEN SQL Server Example
SQL Server > Built-in Functions > LEN
Returns then length of string expression.
Example
declare @str nvarchar(max)
set @str='SQL Server'
select Len(@str)
result:
10
Returns then length of string expression.
Example
declare @str nvarchar(max)
set @str='SQL Server'
select Len(@str)
result:
10
Etichete:
SQL Server
Thursday, January 30, 2014
HOST_NAME SQL Server Example
SQL Server > Built-In Functions > HOST_NAME
Represents the workstation name, name of computer connected to SQL Server.
SELECT HOST_NAME()
Represents the workstation name, name of computer connected to SQL Server.
SELECT HOST_NAME()
Etichete:
SQL Server
LINQ DataTable compare date VB.NET
VB.NET > Data > DataTable > Filter with LINQ
LINQ DataTable compare date VB.NET example
dt.Columns.Add("name", Type.GetType("System.String"))
dt.Columns.Add("date_of_birth", Type.GetType("System.DateTime"))
dr("name") = "john"
dr("date_of_birth") = #1/1/2000#
dt.Rows.Add(dr)
dr("name") = "dan"
dr("date_of_birth") = #9/11/1973#
dt.Rows.Add(dr)
Select n).CopyToDataTable()
LINQ DataTable compare date VB.NET example
Dim dt As DataTable = New DataTable("table")
dt.Columns.Add("id", Type.GetType("System.Int32"))dt.Columns.Add("name", Type.GetType("System.String"))
dt.Columns.Add("date_of_birth", Type.GetType("System.DateTime"))
Dim dr As DataRow = dt.NewRow()
dr("id") = 1dr("name") = "john"
dr("date_of_birth") = #1/1/2000#
dt.Rows.Add(dr)
dr = dt.NewRow()
dr("id") = 2dr("name") = "dan"
dr("date_of_birth") = #9/11/1973#
dt.Rows.Add(dr)
Dim filteredTable As DataTable = (From n In dt.AsEnumerable()
Where n.Field(Of Date)("date_of_birth") = #9/11/1973#Select n).CopyToDataTable()
Etichete:
VB.NET
Wednesday, January 29, 2014
DateAdd VB.NET Example
VB.NET > Functions > DateAdd
DateAdd: add or subtract a specified time interval from a date.
Example:
Label1.Text = Date.Now
Label2.Text = DateAdd(DateInterval.Day, 1, Date.Now)
Label3.Text = DateAdd(DateInterval.Month, 1, Date.Now)
Label4.Text = DateAdd(DateInterval.Year, 1, Date.Now)
DateAdd: add or subtract a specified time interval from a date.
Example:
Label1.Text = Date.Now
Label2.Text = DateAdd(DateInterval.Day, 1, Date.Now)
Label3.Text = DateAdd(DateInterval.Month, 1, Date.Now)
Label4.Text = DateAdd(DateInterval.Year, 1, Date.Now)
Etichete:
VB.NET
Tuesday, January 28, 2014
LINQ FirstOrDefault C# Example
C# > LINQ > FirstOrDefault
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
Example
string[] cars = { "audi", "ford", "mercedes", "dacia" };
string car = cars.FirstOrDefault(c => c == "ford"); //ford
car = cars.FirstOrDefault(c => c == "ford1"); //null
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
Example
string[] cars = { "audi", "ford", "mercedes", "dacia" };
string car = cars.FirstOrDefault(c => c == "ford"); //ford
car = cars.FirstOrDefault(c => c == "ford1"); //null
Etichete:
c#
Subscribe to:
Posts (Atom)