Search This Blog

Friday, July 31, 2015

Read fast text file line by line C#

C# > Files > File Class > OpenText

Open text file for reading line by line.

Example

Read fast text file line by line C#

using (StreamReader sr = File.OpenText(@"c:\filename.txt"))
{
   while (!sr.EndOfStream)
   {
     sr.ReadLine();
    }
}







Monday, July 27, 2015

INSERT SQL Server Example

SQL Server > DML > INSERT

INSERT adds one or more rows to a table or a view.


  • When insert data into a view, the view must reference exactly one base table in the FROM clause of the view. 
  • When insert into a multi-table view you must use a column list that references only columns from one base table. 


Example


INSERT INTO Sales (ProductName, Price, [Date])
VALUES ('Product1', 200, GETDATE());




Friday, July 24, 2015

How to bind to a parent DataContext WPF

WPF > RelativeSource



IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.IsAPGCSourceFitted}"

Monday, July 20, 2015

Day VB.Net Example

VB.NET > Functions > Day

Day returns the day of the month as an integer between 1 and 31.

Example


Dim today As Integer = Microsoft.VisualBasic.DateAndTime.Day(Now)