This category contains 5 posts

Best practice to check for DBNull using .Net:

When we retrieve data from database it is very important for to check for NULL values if writing a robust application. Here are following ways on how to accomplish this need: 1) Using System.Convert: There is a direct method available to Check for DBNull. Here is what you have to do: // Assuming that a … Continue reading

Find stored procedure in all databases

Are you looking for a way to find procedure in all databases? In this post you will find a way to search procedure in all databases. There are some other ways to do so but here it will be demonstrated by using dynamic SQL. The attached procedure will prepare a query with respect to all … Continue reading

Format XML using VB.Net

While working with xml it is more meaningful to the user if xml could appear in a hierarchical manner which can increase understandability. For example the below sample is preferable from perspective of readability and understandability: <?xml version=”1.0″?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body> <name>abc</name> <message>Don’t forget me this weekend!</message> </body> </note> while this detracts the … Continue reading

This document already has a ‘DocumentElement’ node

This happens when we do not assign name to each row as well as root element. So by default system takes DocumentElement as node name which at later stage throws error on validating node.Here is a snap shot: To resolve this issue, we must have to assign name to the ROOT element. for example this … Continue reading

Error: Cannot serialize the DataTable. DataTable name is not set

This happens when we call WriteXml method of DataTable: This exception is raised when we serializes a DataTable when its TableName Property is not set. So, to stop getting this error you have to ensure that the DataTable have TableName property set. NOTE: This do not worth if you are using XMLDataDocument. But remember, XMLDataDocument … Continue reading