December 15, 2003

LoadAssembly – Loading an assembly identified by the path or the partial name

‘ Load an assembly identified by the path or the partial name’ Note: requires Imports System.Reflection’ ‘ Examples:’ 1) Dim asm As [Assembly] = LoadAssembly(“System.Web”)’ 2) Dim asm As [Assembly] = LoadAssembly(“C:MyAppMyAssembly.dll”) Function LoadAssembly(ByVal asmFile As String) As [Assembly] Dim asm As [Assembly] Try ‘ attempt to load the assembly

DataTable2CSV – Saving a DataTable to a CSV file

‘ Save the input DataTable to a CSV file. By default the values are Tab ‘ delimited, but you can use the second overload version to use any other ‘ string you want.” Example:’ Dim ds As New DataSet’ SqlDataAdapter1.Fill(ds, “Users”)’ DataTable2CSV(ds.Tables(“Users”), “D:Users.txt”)Sub DataTable2CSV(ByVal table As DataTable, ByVal filename As

FindFiles – Finding all files with a given filespec

‘ Finding all files with a given filespec into an ArrayList. Optionally scan ‘ also subdirectories of the input dir” Example:’ Dim files As New ArrayList’ FindFiles(files, “D:Articles”, “*.doc”, True)’ For Each file As String In files’ Debug.WriteLine(file)’ NextSub FindFiles(ByVal files As ArrayList, ByVal dirname As String, _ ByVal filespec

SortedListFromHashtables – Creating a sorted list that combines the keys from 2 hashtables

‘ Create a case-insensitive sorted list that combines the keys from two ‘ hashtables’ Example:’ Dim slist As SortedList = SortedListFromHashtables(hashTable1, hashTable2)Function SortedListFromHashtables(ByVal ht1 As Hashtable, _ ByVal ht2 As Hashtable) As SortedList ‘ Create a case-insensitive sorted list Dim list As SortedList = _ Specialized.CollectionsUtil.CreateCaseInsensitiveSortedList() ‘ initialize the list

CSV2DataTable – Importing the data contained in a CSV file into a new DataTable

‘ Import the data contained in a CSV file into a new DataTable. By default the ‘ values are Tab delimited, but you can use the second overload version to use ‘ any other string you want.” Example:’ Dim table As DataTable = CSV2DataTable(“D:Users.txt”)’ DataGrid1.DataSource = tableFunction CSV2DataTable(ByVal filename As

Registering a MSDE SP3 instance into a group in Enterprise Manager

I installed MSDE SP3 as per MS’s directions. However, running Enterprise Manager and trying to register the SQL Server instance into a group (this is on the same box that MSDE was installed, BTW) resulted in the old “Server does not exist or access denied” error. This occured whether I