E
Earl
The following piece of code ALWAYS executes without exception on the
PocketPC device, but often throws a "null reference" exception when running
in the emulator (2002 emulator). However, sometimes it executes in the
emulator without exception!
The exception occurs at the point where I execute the fill on the dataset
table, which normally would say that the server connection is closed. So I
checked that to make sure it was open and forced it open before trying to
fill but I still get the exception on that line -- but only in the emulator.
Anyone have any idea why the exception in the emulator and not the device?
***********************************
Dim dvStreetTable As New DataView
If ds.Tables.Contains("dtStreets") Then
ds.Tables("dtStreets").Clear()
End If
Dim strStreets As String = "SELECT DISTINCT StreetName,StreetID FROM
Prospects"
Dim cmd As New SqlCeCommand
cmd.CommandType = CommandType.Text
cmd.CommandText = strStreets
cmd.Connection = strSQLServer
Try
Dim da As New SqlCeDataAdapter(cmd)
'exception break here
da.Fill(ds, "dtStreets")
dvStreetTable.Table = ds.Tables("dtStreets")
dvStreetTable.Sort = "StreetName"
strSQLServer.Close()
Catch
Dim e As Exception
MessageBox.Show(e.Message.ToString)
End Try
PocketPC device, but often throws a "null reference" exception when running
in the emulator (2002 emulator). However, sometimes it executes in the
emulator without exception!
The exception occurs at the point where I execute the fill on the dataset
table, which normally would say that the server connection is closed. So I
checked that to make sure it was open and forced it open before trying to
fill but I still get the exception on that line -- but only in the emulator.
Anyone have any idea why the exception in the emulator and not the device?
***********************************
Dim dvStreetTable As New DataView
If ds.Tables.Contains("dtStreets") Then
ds.Tables("dtStreets").Clear()
End If
Dim strStreets As String = "SELECT DISTINCT StreetName,StreetID FROM
Prospects"
Dim cmd As New SqlCeCommand
cmd.CommandType = CommandType.Text
cmd.CommandText = strStreets
cmd.Connection = strSQLServer
Try
Dim da As New SqlCeDataAdapter(cmd)
'exception break here
da.Fill(ds, "dtStreets")
dvStreetTable.Table = ds.Tables("dtStreets")
dvStreetTable.Sort = "StreetName"
strSQLServer.Close()
Catch
Dim e As Exception
MessageBox.Show(e.Message.ToString)
End Try