January 2008 Entries

Send e-mail with attachment from database image column (sql server 2k5)

Soooo...I needed to get files out of my SQL Server table (which has the files in an image column) and attach them to an email to send out. I honestly thought this would be a no-brainer but turned out it was pretty finicky. Anyway...the code to so is below just in case anyone is wondering. Partial Class _Default Inherits System.Web.UI.Page Function SendEmail() 'Get your data (filename, content type, image column) from the db Dim dt As DataTable = GetYourStuff() If dt.Rows.Count <= 0 Then Return...

Alternatives to FindControl()?

Alright, as much as I try to avoid using FindControl() sometimes I need to get a control by its ID. I came across what seems like a good idea here : http://www.thescripts.com/f... It's in C#, but here is the VB.NET adaptation... 549 Private Sub BuildControlHashTable() 550 Dim cName As String = String.Empty 551 For i As Int16 = 0 To Me.Controls.Count - 1 552 cName = Me.Controls(i).ID 553 If Not (cName Is Nothing) Then 554 cntrlHashTbl.Add(cName, Me.Controls(i)) 555 End If 556 Next...

Twitter