Importing IIS Logs into a SQL Database / Table

1. Download the Log Parser tool from Microsoft here. I know, it’s old but works great.

2. Dump your IIS log files somewhere (ie: c:\temp\logs).

3. Run this in cmd:

C:\Program Files (x86)\Log Parser 2.2>logparser “SELECT * INTO iisLogs FROM c:\temp\logs\*.log ” -i:iisw3c -o:SQL -server:localhost -database:webLogs -username:sa -password:yourpass -createTable: ON

if you’re on 32bit, run Log Parser will be in this folder:

C:\Program Files\Log Parser 2.2>logparser “SELECT * INTO iisLogs FROM c:\temp\logs\*.log ” -i:iisw3c -o:SQL -server:localhost -database:webLogs -username:sa -password:yourpass -createTable: ON

Now you have a table w/ tons of data!

Update:

In an updated article, I discuss increasing import performance the transactionRowCount option.

Importing IIS Logs into a SQL Database / Table

VB.net Measure string width & height – including multi-line strings

Dim fontToMeasure As New Font("Microsoft Sans Serif", 14, FontStyle.Bold)
Dim sizeOfString As New SizeF
Dim g As Graphics = Me.CreateGraphics

sizeOfString = g.MeasureString("This is line 1" & vbcrlf & "This is line 2", fontToMeasure)
Debug.WriteLine("String Height: " & sizeOfString.Height)
Debug.WriteLine("String Width: " & sizeOfString.Width)

If you want to limit the width (so it wraps), use below (300 was my width to set as max):

Dim fontToMeasure As New Font("Microsoft Sans Serif", 14, FontStyle.Bold)
Dim sizeOfString As New SizeF
Dim g As Graphics = Me.CreateGraphics

sizeOfString = g.MeasureString("This is line 1" & vbcrlf & "This is line 2", fontToMeasure, 300)
Debug.WriteLine("String Height: " & sizeOfString.Height)
Debug.WriteLine("String Width: " & sizeOfString.Width)
VB.net Measure string width & height – including multi-line strings

Creating & Playing Playlist – VB.Net Windows Media Player Control

'create playlist
 Dim newPlayList As WMPLib.IWMPPlaylist = wmpControl.playlistCollection.newPlaylist("soundsToPlay")
 newPlayList.appendItem(wmpControl.newMedia("C:\Sample1.mp3"))
 newPlayList.appendItem(wmpControl.newMedia("C:\Sample2.mp3"))
'play the list
 wmpControl.Visible = False
 wmpControl.currentPlaylist = newPlayList
 wmpControl.stretchToFit = True
 wmpControl.Ctlcontrols.play()
Creating & Playing Playlist – VB.Net Windows Media Player Control