Can anybody explain to me why the following sub on the development machine runs smoothly, but when I deploy and install on another pc I get an error.
The Error I get is “Couldnt show any because: Object reference not set to an instance of an object”
While on the development machine it works.
Both running Win7, I inclluded all sql files as stated on the deployment instruction for datafile and sql-ce dll’s from the msdn.
The datafile is fine and connection is good, becuase a “cmd.ExecuteNonQuery()” runs without problems.
Public Sub LoadFolders()
Dim ds As New DataSet
Dim da As SqlCeDataAdapter = New SqlCeDataAdapter()
Dim cmd As SqlCeCommand
Try
cmd = New SqlCeCommand("SELECT distinct(folder) from addressbook", connection.DbPrivate)
cmd.CommandType = Data.CommandType.Text
Catch e As Exception
Console.WriteLine("Could not execute sql: {0}", e.Message)
End Try
Try
With da
.SelectCommand = cmd
.Fill(ds, "folders")
End With
Catch e As Exception
Console.WriteLine("Unable to fill dataset: {0}", e.Message)
End Try
Try
For Each irow As DataRow In ds.Tables("folders").Rows
MsgBox(irow(0))
Next
Catch e As Exception
MsgBox("Couldnt show any because: " + e.Message) 'this is the error that pops up.
End Try
End Sub
I think your problem might be in the connection string, make sure it is right and then check if you had included any references that they are included on the other pc.