Reviving My Blog
Just a quick note that I’m reviving my neglected blog.
- Lari
— Amy Hoy
From MSDN - System.Data.ConnectionState :
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
yet
Note: The values in this enumeration are not designed to be used as a set of flags.
Huh? Then why did you give it a FlagsAttribute?
In .Net 2.0:
So I had a situation where, given a string, I needed to know whether it was a date/time or not. Use DateTime.TryParse(), obviously.
This worked fine until we started feeding it strings in the form 111PM1 (three digits, “PM”, and another digit). These, it tells me, are really dates.
For example, ‘813PM4’ gets translated to ‘4/1/0813 12:00:00 PM’ and ‘023AM6’ gets translated to ‘6/1/0023 12:00:00 AM’.
Has anyone else ever seen dates in this format (YYYam/pmM)?
In the meantime, since we’ll never have 4 digits in the “year” position, I just make sure any “dates” are greater than 1/1/1000 before believing DateTime.TryParse(), which works for my situation.
I’m trying this out for a situation where I need to evaluate expressions. If it works like the docs say it should, this will become one of my favorite libraries.
Update:
I did eventually go with FLEE, but ran into difficulties due to its need to know what types things are (that was awkward since I was feeding arbitrary values from a database record - they were coming back as object & wouldn’t compare with an integer). So I put in a kluge so that my functions that retrieved the data row values also cast/converted to the target type.
Not as pretty as I’d like but functional.
Problem:
When you add a script task or component to an SSIS (Sql Server Integration Services) 2005 package, you get errors like: “The dependency ‘Microsoft.SqlServer.DtsMsg’ could not be found” (other namespaces are possible). These are typically Microsoft dlls that are present in the GAC, yet Sql Server/Visual Studio can’t find them.
Solution:
You have to copy the dll’s into the .Net Framework directory. This is complicated by the fact that the GAC, where you’ll find them, is hidden from Windows Explorer. Here’s how:
dir /s <pattern>
dir /s dstmsg
I found this solution here: http://forums.microsoft.com/TechNet/ShowPost.aspx?PageIndex=1&SiteID=17&PageID=1&PostID=717965
You could use System.Collections.Specialized.NameValueCollection, but only if both your names and values are Strings. Here’s how (click the title) if you need something a bit more general.