Category Archives: Code Library

SQL Server Undocumented Stored Procedures sp_MSforeachtable and sp_MSforeachdb

  –SQL Server Undocumented Stored Procedures sp_MSforeachtable and sp_MSforeachdb –By Gregory A. Larsen –November 30, 2004 –http://www.databasejournal.com/features/mssql/article.php/3441031/SQL-Server-Undocumented-Stored-Procedures-spMSforeachtable-and-spMSforeachdb.htm –This character "?" is the default replacement character for the database name or table name. –sp_MSforeachdb undocumented stored procedure –http://www.google.com/search?q=sp%5fmsforeachdb –exec @RETURN_VALUE = … Continue reading

Posted in Code Library | Leave a comment

ShouldSerialize, Reset, Default, and Property Snippet Methods

Windows Forms Programming, Defining Default Values with the ShouldSerialize and Reset Methods ”’ <summary> ”’ Gets or sets the registry key hive for the MRUKey property. ”’ </summary> <Description("The registry hive where the combo box maintains the MRU list")> _ … Continue reading

Posted in Code Library | Leave a comment

BitArray/ToString/BitArrayToString

How do I convert a bit array to a binary string? How do I retrieve/return the numeric value of a bit array? I only implemented ToInt32 to illustrate how to round-trip the binary string into a numeric value to get … Continue reading

Posted in Code Library | Leave a comment

Creating an Object Debug String Using Reflection

Calling Code Public Sub Generate(ByVal args As SummaryReportArgs) Trace.Write("Generate " + Me.ToString, args.ToString) ‘… Trace.Write("Generate " + Me.ToString, "Finished") End Sub Trace Results Generate ASP.mhcm_usercontrols_summaryreport_ascx Missico.Mhcm.Data.SummaryReportArgs    UserID: 20641    SurveyCode: Q3-08    DeviceID: 132    RegionID: 96    VolumeID: … Continue reading

Posted in Code Library | Leave a comment

VB/VBA WriteFile for Debugging/Tracing

Public Sub WriteFile(ByRef strMessage As String) ‘——————————————————————————– ‘ Purpose : Write the message to the specified file ‘ Comments: The open statement uses Lock Write to avoid truncating messages when ‘           multiple writes are occurring from other client applications. This ‘           will cause the run-time … Continue reading

Posted in Code Library | Leave a comment

Excel Filtered Range Enumerator for VBA/NET

An enumerator, based on .NET IEnumerator, for VBA that allows a filtered range to be used as a single range. I designed this code to work in .NET with little modification. ftp://missico.net/RangeEnumerator.zip VERSION 1.0 CLASS BEGIN MultiUse = -1 ‘True … Continue reading

Posted in Code Library | Leave a comment

Appending Count of String Duplicates ][

My previous manager asked a co-worker and I, "Anyone have a generic snippet of code that adds a counter to a list of strings when strings are duplicates? [I] was thinking to use a HashTable then check to see if the … Continue reading

Posted in Code Library | Leave a comment

Recursive FindControl; FindControlRecursive

After reviewing the most “popular” recursive FindControl methods in “blogs”, I find that all the implementations perform recursion first then compare control identifiers. All the “bloggers” complain of performance issues when performing the recursion, but not one programmer notices they … Continue reading

Posted in Code Library | 1 Comment

Visual Basic Code for “Iterating NTFS Streams” by Stephen Toub

Note, while this implementation is “neat”, it is better to return a list of StreamInfo objects from a GetStreams method. (This is how the GetDirectories and GetFiles methods of the System.IO namespace in the .NET Framework are implemented.) You cannot … Continue reading

Posted in Code Library | 1 Comment