I am trying to read data from local database - sdf file. I am using this code to get it:
Private Sub BookEdit_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Using conn As New SqlCeConnection("Data Source=|DataDirectory|Library.sdf;Persist Security Info=False")
conn.Open()
Dim comm = New SqlCeCommand("SELECT * FROM Book", conn)
Dim reader As SqlCeDataReader = comm.ExecuteReader()
While reader.Read()
MessageBox.Show(reader.GetString(0))
End While
End Using
End Sub
When I open this form window, it is just freezing and then closing without showing any error.
Tools -> Options->TextEditor->C#->
Here I have tried to turn on Underline errors in the editor and Show live semantic errors. However my code is in VB.net so when I open same thing for VB.NET there is no this function.
Also tried to turn on Option Strict
Tools->Options->Projects and Solutions->VB defaults
But no effect. Visual Studio is not showing any error. So I do not know where to fix to connect to SDF file and show my windows form.
How to solve this problem?
Info: Visual Studio 2012 Ultimate Windows 8.1 Microsoft .NET framework 4.5.51641