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 […]

getNonce() – a C# routine to generate the Nonce code for WS-Security

I created this code to generate a unique Nonce code. This relates back to this post about BizTalk calling a webservice with Basic Authenticiation. Message Assignment is prior blog was updated to call C# business component: <pre> xmlDocSoapHeader.LoadXml(    "<headers>" +    "<wsse:Security mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" +    "<wsse:UsernameToken wsu:Id=\"UsernameToken-E4E3CB1F68472DCF2914369675811859\">" +      "  <wsse:Username>" + strServiceBenchUserID […]