The techie in me RSS 2.0
 Sunday, January 04, 2009

Someone send me this link today with lot of free software from Microsoft. Checkout here

Some of them are really useful.

Sunday, January 04, 2009 4:50:48 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -

 Tuesday, December 30, 2008

Found some nice guy sharing C# and VB.NET coding standards... might be useful when you dont have enough time(usually never!) to create coding standards from scratch.

check out Clint Edmonson's blog here

 

Tuesday, December 30, 2008 11:16:37 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Coding
 Monday, October 27, 2008

Check out this translation bot, this is really cool, just add  mtbot@hotmail.com to your msn messenger contacts and start chatting it will do the translation for you.... cool isnt it.. messenger is available in Windows mobile too..

see details here....

Monday, October 27, 2008 10:24:10 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Windows Mobile
 Sunday, May 18, 2008

What is the easy and quick way to learn new things ? The answer is, look at samples or FAQ.

Well the obvious next question is how to find out if samples are installed, if they are installed, where are they ?

Visual studio 2008 made it more simple, you can find link to samples inside your VS2008 Help menu itself.

see the screen shot below.

vs2008SampleHelpMenu

 

Wow!, Visual studio again saved my time :)

Remember that you have to unzip the files... as always there are instructions on what to do.

Sunday, May 18, 2008 1:17:35 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Visual Studio
 Saturday, May 17, 2008

If you have worked with strongly typed dataset, it is very likely that you must have faced this annoying exception regularly. The error message will be something like this.

The value for column \'ColumnName\' in table \'TableName\' is DBNull.

With exception type : System.Data.StrongTypingException

Well that's a typical message ain't it ? But interesting part is, if you see the property code in the dataset class it will similar to

get {
    try {
        return ((global::System.String)(this[this.tableName.Column]));
    }
    catch (global::System.InvalidCastException e) {
        throw new global::System.Data.StrongTypingException("The value for column \'Column\' 
                                 in table \'TableName\' is DBNull.", e);
    }
}
set {
    this[this.TableName.Column] = value;
}

Now from the code you can see that, if you are thinking of comparing the field with Dbnull or null or some value still it will give the error. It is a InvalidCast exception.

There is a simple method to solve this issue, when you use the xsd.exe(or VS IDE) to generate the dataset class give a value for the 'null value'

This is how you do it.

1. Add codegen namespace in the scheme

In the xsd file(schema) add the below line to add the namespace immediately after targetnamespace

xmlns:codegen="urn:schemas-microsoft-com:xml-msprop

2. Add the 'null value' to the elements you want to protect from this error.

for ex :

<xs:element name="Column1" codegen:nullValue="-1" type="xs:string" minOccurs="0" />

The bold attribute sets the nullvalue.

 

Thats it, then generate your typed dataset, and you will no longer have the weird exception.

If you really dont want to touch the xsd, there is another way of getting rid of this, the dataset class gives a method 'IsColumnNull', use this method in your code to check if its null :)

The above information is extracted from MS KB article

 

Keep strong typing :)

-Rujith

Saturday, May 17, 2008 1:21:57 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] -
Coding
 Thursday, April 24, 2008

Well, Coding has always been the best part like my job. I really enjoy it, after long time I am coding again, I want to be programmer again. I have been involved in all design discussions, brainstorming sessions for all the complex problems and all those long long sleepy meetings :). But yesterday whole day I was coding, thinking about logic, thinking about shortcuts etc, it was fun , I dono what people sitting near me must have thought about me but I really enjoyed it.

 

Thursday, April 24, 2008 10:14:37 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] -

About me
Name : Rujith Anand Send mail to the author(s)
Archive
<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
Blogs I read
Disclaimer

Disclaimer
Postings are provided as is with no warranties, and confer no rights. Opinions expressed here are my own delusions; my employers at best shake their heads and sigh, at worst repudiate the content with extreme prejudice, whenever it manages to appear on their radar.

© Copyright 2012
Rujith Anand

Statistics
Advertisement
All Content © 2012, Rujith Anand