More Handy .NET
'EXECUTE SQL Scalar or NonQuery
'Ex:
'dim count as integer = Execute("select....",True)
'OR
'Execute("update table set field=val where.... ")
Function Execute(strSQL As String, Optional ExecuteScalar As Boolean = False)
Dim cmd As sqlCommand = conn.CreateCommand
cmd.CommandText = strSQL
If ExecuteScalar Then
Return cmd.ExecuteScalar
Else
Return cmd.ExecuteNonQuery
End If
End Function
'Returns Recordset as Datatable
'Ex:
'dGrid.datasource=FillRecs("select * from table")
Function FillRecs(ByVal sqlString As String) As System.Data.DataTable
Dim recs As DataTable = New DataTable()
Dim sql As New sqlDataAdapter(sqlString, conn)
sql.Fill(recs)
Return recs
End Function
'Returns Row Count
'Ex:
'if hasrecs(Datatable)
Function hasrecs(ByVal r As Data.DataTable) As Boolean
Return (r.Rows.Count > 0)
End Function
CSV Splitter
As usual, rather than download a small program I am certain is available to no end, I decided to reinvent the wheel in order to manage one of my client's need.
The primary function is to split large CSV files and maintain the headers in order to create smaller files for uploading to a catalog website that limits file upload size.
Built on .NET 2.0, does not include framework, no installationChange default IE7 view source program
Adding this as a note for myself and any who may need it in the future. Each time I revamp my system I keep having to go look this up and it seems to be getting harder and harder to find.
How to change the default IE 7 View Source Editor:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\View Source Editor\Editor Name]
@="F:\\TextPad 4\\TextPad.exe"
Copy that and save as "viewsource.reg"
Change the last line to your desired path WITH double blackslashes.
Double click the reg file and approve the registry change.
Poof! No more notepad!
SMS Email Addresses
The site was written in .NET and really did not require a whole bunch - the real trick is coming up with a way to automatically determine the reciever's cellular service provider. for the time being I have a bunch of options to choose from. However, the hardest thing to track down was the actual domains for each provider.
Here is a list of what I have in place so far.
- number@vmobl.com
- number@vtext.com
- number@tmomail.net
- number@messaging.sprintpcs.com
- number@qwestmp.com
- number@mobile.celloneusa.com
- number@messaging.nextel.com
- number@mymetropcs.com
- number@sms.edgewireless.com
- number@mobile.mycingular.com
- number@mobile.celloneusa.com
- number@myboostmobile.com
- number@bellsouth.cl
- number@paging.acswireless.com
- number@message.alltel.com
- number@email.uscc.net
Then a simple CDO.Message and you're done...
http://www.text-send.com
enterprise manager snap-in failed to initialize
If you are playing around with various versions or instances of MS SQL Server you may hit this problem... this worked out for me.
From the command line
regsvr32 "
regsvr32 "
regsvr32 "
regsvr32 "