OpenFileDialog and ADO.NET

J

Jody Gelowitz

VS.NET 2002 and 2003 are installed.
..NET Framework 1.0 and 1.1 installed
Program running under VisualBasic.NET 2002 with .NET Framwork 1.0


I am experiencing a problem with ADO.NET where the Connection object
(OleDBConnection) will not Open (conIncident.Open) given the following
situation:

1. Program is loaded and connection is established to Access database on C:
2. Able to manipulate and view the data in the database with no problems
3. Use the OpenFileDialog to select a file in A: from which to merge data
to the database on C: (The file on A: is a text file which is parsed to
merge data into the database on C:)
4. After the merge, remove the Floppy disk from A:
5. Now, whenever I try to perform an operation on the database, I get the
following error message: "Disk or network error. Microsoft JET Database
Engine"
6. If I insert the disk, then I am able to perform database operations on
C: with no problems, except that it keeps checking A: for a disk.


Other things that I found include:

A) If I select a file in A: using the OpenFileDialog, hit OK to select the
file, then do NOT perform the merge operation, I still get the error.

B) If I select a file in A: using the OpenFileDialog then hit Cancel, the
error will not appear.

C) If I do not use the OpenFileDialog and hardcode the path to A: and
perform the merge with this, then I will not get any errors.


Given what I have found so far, there appears to be a problem with the
OpenFileDialog and Access database programming with ADO.NET. Has anybody
experienced this type of bevavior before, and if so, is there a solution?

Thanks,
Jody
 
C

Chris R. Timmons

VS.NET 2002 and 2003 are installed.
.NET Framework 1.0 and 1.1 installed
Program running under VisualBasic.NET 2002 with .NET Framwork
1.0


I am experiencing a problem with ADO.NET where the Connection
object (OleDBConnection) will not Open (conIncident.Open) given
the following situation:

1. Program is loaded and connection is established to Access
database on C: 2. Able to manipulate and view the data in the
database with no problems 3. Use the OpenFileDialog to select a
file in A: from which to merge data to the database on C: (The
file on A: is a text file which is parsed to merge data into the
database on C:) 4. After the merge, remove the Floppy disk from
A: 5. Now, whenever I try to perform an operation on the
database, I get the following error message: "Disk or network
error. Microsoft JET Database Engine"
6. If I insert the disk, then I am able to perform database
operations on C: with no problems, except that it keeps checking
A: for a disk.


Other things that I found include:

A) If I select a file in A: using the OpenFileDialog, hit OK to
select the file, then do NOT perform the merge operation, I
still get the error.

B) If I select a file in A: using the OpenFileDialog then hit
Cancel, the error will not appear.

C) If I do not use the OpenFileDialog and hardcode the path to
A: and perform the merge with this, then I will not get any
errors.


Given what I have found so far, there appears to be a problem
with the OpenFileDialog and Access database programming with
ADO.NET. Has anybody experienced this type of bevavior before,
and if so, is there a solution?

Jody,

By default, OpenFileDialog changes the current directory when a file
is selected. Set the dialog's RestoreDirectory to true to avoid this
behavior.

Hope this helps.

Chris.
 

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