Screwball emulator issue?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top