469,954 Members | 1,633 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

OpenFileDialog and ADO.NET

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
Jul 21 '05 #1
3 2791
Hi Jody,

How do you read the data from A:? Do you close the stream?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"Jody Gelowitz" <jo**@mail.visualstatement.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Jul 21 '05 #2
"Jody Gelowitz" <jo**@mail.visualstatement.com> wrote in
news:#5**************@TK2MSFTNGP12.phx.gbl:
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.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jul 21 '05 #3
Thanks.

Setting RestoreDirectory = True fixed the problem.

Jody

"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"Jody Gelowitz" <jo**@mail.visualstatement.com> wrote in
news:#5**************@TK2MSFTNGP12.phx.gbl:
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.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by bobrad | last post: by
4 posts views Thread by Nagachandra Sekhar Grandhi | last post: by
8 posts views Thread by e-mid | last post: by
6 posts views Thread by barbara_dave | last post: by
3 posts views Thread by Martijn Mulder | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.