Get the SQL Server Name of BizTalk in C#

Sometimes, you might need to get the SQL Server Name of the SQL Server where the BizTalkMgmtDB The C# code below, uses the registry to get that server name, and also builds a connection screen to some database on that server (where you pass the Database Name as a parameter). MgmtDBServer (in the rk.GetValue below), […]

Speeding up Getting all Files in Directory after a Certain Date

There was a typo below, the first time is using LINQ, the second one is using Directory.GetFiles (then getting the time on each file within a loop). Big Difference, right? The last one is 41 times slower. The difference was not really using LINQ, but using the DirectoryInfo.GetFiles instead of the combination of Directory.GetFiles and […]

C# DateTime and Oracle DateTime ORA-01843

I got this error: ORA-01843 Oracle date format picture ends before converting entire input string The variable fileDateTime was a defined as a normal C# DateTime. Code Failed with ORA=01843                     commSQL.CommandText = "UPDATE MY_TAB " +                         " SET DATE_FILE_PROCESSED = TO_DATE('" + fileDateTime + "', 'MM/DD/YYYY HH:MI:SS')" +                           " WHERE DATE_FILE_PROCESSED IS NULL AND CUST_PO_NO […]

Traverse XML Elements/Values with XmlDocument in C#

I’m in the process of writing a C# program that will validate field sizes (and maybe data types) against a SQL table. I need to traverse through each element and get the element value, the next step will be to validate it each element value. The code below will “walk the tree” structure of the […]

Mass Delete of Old Rows in T-SQL

I have a SQL/Trace, and it’s a requirement to each night delete all rows in the Trace over x days old. This is typically called a purge program, or mass delete. If you don’t limit the data, then you can knock the lights out of SQL. Below is a modification to code I found here: […]

VBScript Function to Count Rows in a CSV File

I was working with an old third party tool that only supported VBScript for programming.  I needed to email a file if the file had more than one row.  All the CSV (Comma Separated Value) files created had the CSV headers on the first line. Basically, this was an error/exception report, so I only wanted […]

VBScript Date Formatting For Filenames

Below is just a code fragment that creates a date useful for putting on a filename. It’s not particular elegant, and there are other ways to do the same thing (for example using the PAD function). But it works and it’s easy to read and change. dtYear  = year(date) dtMonth = Right(String(2,"0") & Month(date), 2) dtDay   […]

VBScript Function to Delete Files in Directory matching name over x days old

Yes, it’s the year 2015, and I still find myself creating VBScripts from time to time. My client has an old server that uses a third party tool to do database extracts, and it supports only VBScript. So we have scripts that email CSV (Comma Separated Value) extracts, and/or copy them to various folders on […]

Error Handler – Issue with xmlDocument losing value because of Scope/Throw

We all hate to use Atomic Scopes in BizTalk orchestrations when not needed.  I have a static C# Trace routine that normally takes passing an enum of System.Diagnostics.TraceLevel (for Error, Warning, Info, etc…).   In the current project, our web services can return “soft errors” in a common field called “Result”. So I could have used […]

Error: a non transactional scope ‘unnamed’ may not contain a transactional scope

Here are some helps for this error that I got today: Error: a non transactional scope 'unnamed' may not contain a transactional scope 'Transaction_3" When you click on the error in the Visual Studio Error list, it should take you to one of the scopes involved in the error. In my case, I had a […]