Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 19th, 2005, 04:58 PM
Authorized User
 
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataSet to XML

hi all,
when creating xml file from dataset using dataset.writeXML, it excludes the columns which have null values. Is there a way so that it will keep that columns as well.

thanks
 
Old October 21st, 2005, 01:09 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

are all the values NULL for each row in the column?

 
Old October 21st, 2005, 01:49 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I see your problem. Even if you replace it with blanks, you will still only get the end tag of the element. I have found no resolution to the problem. Let me know if you do.

Jim

 
Old October 26th, 2005, 11:56 PM
Authorized User
 
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i haven't found so far. I will post if i find it.
thanks
 
Old December 30th, 2005, 07:30 AM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to trevski
Default

Try applying this to the dataset.

    Public Sub returnNullsEmpty(ByRef ods As DataSet)
        Dim oTable As DataTable
        Dim oRow As DataRow
        Dim oColumn As DataColumn

        Dim cProcessInfo As String = "getDataReader"
        Try
            For Each oTable In ods.Tables
                For Each oRow In oTable.Rows
                    For Each oColumn In oTable.Columns
                        If IsDBNull(oRow.Item(oColumn.ColumnName)) Then
                            Select Case oColumn.DataType.ToString
                                Case "System.DateTime"
                                    oRow.Item(oColumn.ColumnName) = CDate("01/01/1900")
                                Case "System.Integer"
                                    oRow.Item(oColumn.ColumnName) = 0
                                Case Else
                                    oRow.Item(oColumn.ColumnName) = ""
                            End Select
                        End If
                    Next
                Next
            Next
        Catch ex As Exception
            returnException(mcModuleName, "setDataSet", ex, "", cProcessInfo, mbDebug)
        End Try

    End Sub

Eonic - Suppliers of bespoke web solutions and EonicWeb Content Management.
 
Old February 1st, 2006, 04:06 PM
Registered User
 
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hve you guys found any solution yet?
 
Old February 6th, 2006, 08:43 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Does it help to use ISNULL in the select statement?

SELECT ISNULL(Column1,'') AS Column1, ISNULL(Column2,'') AS Column2, etc.

???







Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I load this xml to a dataset? chepla C# 2005 1 August 11th, 2008 08:51 AM
Generate Xml from DataSet monuindia2002 XML 0 March 22nd, 2006 01:06 AM
Getting XML from DataSet monuindia2002 XML 1 March 19th, 2006 07:14 AM
load values into the dataset from the xml dhol XML 1 December 31st, 2004 05:34 AM
Appending one xml dataset to another badgolfer ASP.NET 1.0 and 1.1 Basics 0 October 18th, 2004 09:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.