Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Avoiding the XML preserve syntax
Message
De
30/04/2006 01:39:52
 
 
À
29/04/2006 19:31:27
Information générale
Forum:
ASP.NET
Catégorie:
XML
Divers
Thread ID:
01117317
Message ID:
01117866
Vues:
14
On further experimentation, it seems this is something extra that's been added to 2.0 when you use a DataAdapter.Fill(). I don't know how to turn it off. Further experimentation may be necessary. I don't know if this is a good thing or not (I hate things that aren't backwards compatible).

~~Bonnie




>>Then your main DataSet has that property set. Where do you get that one from?
>
>The main dataset is created from my data class, the one we worked on two months ago here on this forum. Basically, it goes like this:
>
>
>Imports System.Data.Common
>Imports System.Data.OleDb
>Imports System.Data.SqlClient
>Imports System.Data.Odbc
>
>Namespace Framework
>
>    Public Class Data
>
>        Public oDataSet As DataSet
>        ...
>
>        Public Sub New(ByVal toApplication As Framework.App)
>            oApp = toApplication
>        End Sub
>
>        ' SQL exec
>        ' expC1 SQL command
>        ' expO1 Connection
>        Public Function SQLExec(ByVal tcSQL As String, ByVal tcConnection As String) As Boolean
>
>            ' If the applicatioan object has not been created
>            If oApp Is Nothing Then
>                Throw New System.Exception("The application object has not been passed to the data object.")
>            End If
>
>            ' If no connection string
>            If tcConnection.Length = 0 Then
>                oApp.cError = "Framework.Data.SQLExec() The connection string is empty. " + tcSQL
>                Return False
>            End If
>
>            InitializeDataObject(oApp.nSQLMode, tcConnection, tcSQL)
>            Dim llSuccess As Boolean
>            llSuccess = False
>            Try
>                oCommand.Connection = oConnection
>                oCommand.CommandText = tcSQL
>
>                ' Only add the parameters if we have some
>                If Not oParameters2 Is Nothing Then
>                    For Each oDataParameter In oParameters2
>                        oCommand.Parameters.Add(oDataParameter)
>                    Next
>                End If
>
>                oDataAdapter.SelectCommand = oCommand
>                oDataSet = New DataSet
>
>                ' By default, .NET does not add the specific field length, which is needed in XML as at the other end
>                ' someone would always get memo field instead of character field
>                oDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
>
>                oDataAdapter.Fill(oDataSet)
>
>                ' Adjust to our default name
>                oDataSet.Tables("Table").TableName = "Temp"
>
>                ' Record count
>                nCount = oDataSet.Tables("Temp").Rows.Count
>
>                ' If we have at least one record
>                If nCount > 0 Then
>                    oDataView = New DataView
>                    oDataView = oDataSet.Tables("Temp").DefaultView
>                End If
>
>                llSuccess = True
>            Catch loError As Exception
>                oApp.cError = oApp.ErrorSetup(loError, oApp.Debug(cSQL))
>            End Try
>            Return llSuccess
>        End Function
>
>        Private Function InitializeDataObject(ByVal tnConnType As Integer, ByVal tcConnection As String, _
>         ByVal tcSql As String) As IDbConnection
>            Dim loEnumerator As IEnumerator = oParameters.GetEnumerator
>            Dim loParameter As Object
>            cConnectionString = tcConnection
>            cSQL = tcSql
>            Select Case tnConnType
>                Case 1
>                    oConnection = New OleDbConnection(tcConnection)
>                    oDataAdapter = New OleDbDataAdapter
>                    oCommand = New OleDbCommand
>                    oDataParameter = New OleDbParameter
>                    While loEnumerator.MoveNext
>                        loParameter = loEnumerator.Current
>                        oParameters2.Add(New OleDbParameter(loParameter(1, 1).ToString, loParameter(1, 2)))
>                    End While
>                Case 2
>                    ...
>            End Select
>            Return oConnection
>        End Function
>
>    End Class
>
>End Namespace
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform