Geeks With Blogs
Jim Lahman's Blog Fortitude|Endurance|Faith|Teamwork May 2009 Entries
C# - Checking for NULL
If the column you are reading has the potential for a NULL value, then you must use the DBNull object: DataRowView dRowView = m_SchedCommentsBindingSourc... as DataRowView; dsL2DB.SchedulesRow SchedRow = dRowView.Row as dsL2DB.SchedulesRow; sDeleteComment = (SchedRow["DeleteComment"] == DBNull.Value ? "No Delete Comment" : SchedRow.DeleteComment); More generically: If (ds.Rows[0]["ColumnName"] == DBNull.Value) { // Do something for NULL value } ......

Posted On Tuesday, May 26, 2009 5:04 PM

Powershell output
I'm beginning to write simple scripts in powershell. One of the things items that really isn't straight forward is the write-output command. At first glance, one would think that this would simply output a string. Well, there is a trick I found. PS>write-output xxxxxxxx yyyyyyyyy really outputs xxxxxxxx yyyyyyyyy PS>write-output "xxxxxxxx yyyyyyyyy" really outputs xxxxxxxx yyyyyyyyy PS> $A = 10 PS>$B = 20 PS>write-output "A = $A B = $B" really outputs A = 10 B = 20 ......

Posted On Thursday, May 14, 2009 3:30 PM

Copyright © Jim Lahman | Powered by: