In my code, why does nothing execute after con.Open()
.
If I step through each step, it ends the Form1_Load
event after con.Open()
.
Imports System.Data.OleDb
Public Class Form1
Dim con As OleDbConnection
Dim strCon As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=C:\testDB.accdb"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con = New OleDbConnection(strCon)
con.Open()
MsgBox("con open")
con.Close()
MsgBox("con closed")
End Sub
End Class
Sounds like an Error is begin raised.
Have you tried framing your code with OnError Goto Handler
type code? See the On Error Statement.
If this is VB.NET, trying catching an exception with Try ... Catch
. Then set a breakpoint on the Catch
statements to find out what the error is.