G
Guest
I have a full discourse in a recent post. But the
problem starts at the beginning. I start the program
with sub main. I put in msgboxes right at the beginning
to see where I stood before the error. When I run the
application, the message boxes before the cn.open
statement are not popped up on the screen. The program
goes directly to the connection error.
An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll
And the first three words of the statement
Dim cn As New OleDbConnection(gstrConn) are green.
What is going on? I'm misunderstanding something
fundamental. Please help.
dennist
Imports System.io
Imports System.Data
Imports System.Data.OleDb
Module modPrimary
Friend gstrConn As String
= "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" 'H:\HasbaraNET\ado.net
tests\adonetTest\HasbaraSample.mdb;"
Public s As String
Public gSelectedFile As String
Public gForm As Form
Public gsTopicText As String
Public gID As Integer
Public gsPath As String
Public Sub Main()
MsgBox("sub main opened")
Dim strPath As String
Dim strSubstring As String
Dim intIndexof As Integer
Dim cls1 As New Class1
strPath =
System.Reflection.Assembly.GetExecutingAssembly.Location
intIndexof = strPath.IndexOf("bin")
strSubstring = strPath.Substring(0, intIndexof)
gsPath = strSubstring
ChDir(strSubstring)
gstrConn = gstrConn & "HasbaraSample.mdb;"
SetGlobals()
MsgBox(gstrConn)
Dim cn As New OleDbConnection(gstrConn)
cn.Open()
MsgBox("sub main opened")
Application.Run(New frmTopicFromStart)
End Sub
Public Sub SetGlobals()
gSelectedFile = ""
End Sub
End Module
problem starts at the beginning. I start the program
with sub main. I put in msgboxes right at the beginning
to see where I stood before the error. When I run the
application, the message boxes before the cn.open
statement are not popped up on the screen. The program
goes directly to the connection error.
An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll
And the first three words of the statement
Dim cn As New OleDbConnection(gstrConn) are green.
What is going on? I'm misunderstanding something
fundamental. Please help.
dennist
Imports System.io
Imports System.Data
Imports System.Data.OleDb
Module modPrimary
Friend gstrConn As String
= "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" 'H:\HasbaraNET\ado.net
tests\adonetTest\HasbaraSample.mdb;"
Public s As String
Public gSelectedFile As String
Public gForm As Form
Public gsTopicText As String
Public gID As Integer
Public gsPath As String
Public Sub Main()
MsgBox("sub main opened")
Dim strPath As String
Dim strSubstring As String
Dim intIndexof As Integer
Dim cls1 As New Class1
strPath =
System.Reflection.Assembly.GetExecutingAssembly.Location
intIndexof = strPath.IndexOf("bin")
strSubstring = strPath.Substring(0, intIndexof)
gsPath = strSubstring
ChDir(strSubstring)
gstrConn = gstrConn & "HasbaraSample.mdb;"
SetGlobals()
MsgBox(gstrConn)
Dim cn As New OleDbConnection(gstrConn)
cn.Open()
MsgBox("sub main opened")
Application.Run(New frmTopicFromStart)
End Sub
Public Sub SetGlobals()
gSelectedFile = ""
End Sub
End Module