none
使用vb2005, sql server 2005 compact edition, 使用xml reader時,發生exception RRS feed

  • 問題

  •   當我使用使用vb2005, sql server 2005 compact edition, 使用xml reader時,發生exception 在windows CE上執行時會發生Exception, 但是我把code 拆開,xml reader 跟 database connection 分開兩個program 執行時卻又沒有發生exception.

    而出來的exception message 是空白的

    請問為什麼會有這樣的情況呢?

    程式碼:

    --------------------------------------------------------------------------------------------------------

    Imports System.Data.SqlServerCe
    Imports System.Xml

    Public Class Form1

     

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim DBPath As String

            Dim mydr As XmlTextReader = New XmlTextReader(m_sXMLFileName)
            mydr.WhitespaceHandling = WhitespaceHandling.None

            While mydr.Read()
                ' Look for the <configuration> section
                ' This lets us add several peices in the config file
                If mydr.Name = "DBPath" Then
                    DBPath = mydr.Name
                End If
            End While
            mydr.Close()

            Me.MobileDataTableAdapter.Connection.ConnectionString = "Data Source =""\Program Files\CEdatabase\MobileDatabase.sdf"";"
            Try
                If MobileDatabaseDataSetUtil.DesignerUtil.IsRunTime Then
                    'TODO: Delete this line of code to remove the default AutoFill for 'MobileDatabaseDataSet.MobileData'.
                    Me.MobileDataTableAdapter.Fill(Me.MobileDatabaseDataSet.MobileData)
                End If

            Catch ex As SqlCeException
                MessageBox.Show(ex.toString())
            End Try
        End Sub

    End Class

    2007年7月24日 上午 07:14