Friday, October 7, 2011
Saturday, September 24, 2011
SQL window function
Just read the SQL cookbook and learn userful sql windows function.
Over()
NTILE
TSQL Date and Time function
WITH common_table_expression (Transact-SQL)
See a good list of SQL tutorial while googling:
Tuesday, September 20, 2011
Debugging Design-Time Controls
Microsoft's article for debugging design time Control
Design mode property
Reference:
Saturday, September 10, 2011
Friday, September 9, 2011
CSV Reader in VB.net
Public Shared Function CsvToDataTable(ByVal filePath As String, ByVal isRowOneHeader As Boolean) As DataTable
Dim afile As TextFieldParser = New TextFieldParser(filePath)
afile.TextFieldType = FieldType.Delimited
afile.Delimiters = New String() {","}
afile.HasFieldsEnclosedInQuotes = True
Dim index As Integer = 0
Dim csvDataTable As DataTable = New DataTable()
Dim headings() As String
If (isRowOneHeader) Then
index = 1
Dim row As DataRow = csvDataTable.NewRow
headings = afile.ReadFields
For i As Integer = 0 To headings.Length - 1
csvDataTable.Columns.Add(headings(i), Type.GetType("System.String"))
If Not String.IsNullOrEmpty(headings(i)) Then
row(i) = headings(i)
End If
Next
End If
Do While Not afile.EndOfData
Try
Dim row As DataRow = csvDataTable.NewRow
Dim csvDataRowStr = afile.ReadFields
For j As Integer = 0 To headings.Length - 1
If Not String.IsNullOrEmpty(csvDataRowStr(j)) Then
row(j) = csvDataRowStr(j)
End If
Next
csvDataTable.Rows.Add(row)
Catch ex As FileIO.MalformedLineException
Throw
End Try
Loop
Return csvDataTable
End Function
Reference:
Monday, September 5, 2011
Sunday, August 28, 2011
Subscribe to:
Posts (Atom)