System.InvalidOperationException: ExecuteReader

G

Guest

Hi, I have a little application coded with .net 1.1, my problem is that this
application worked fine in W2000. But the client change to XP, and from that
get this error.
This problem show when try to read from a table of Access XP.
Anybody knows why this happen now and not with W2000 ???

Thanks
 
C

Chad Z. Hower aka Kudzu

=?Utf-8?B?TmVncmk=?= said:
Hi, I have a little application coded with .net 1.1, my problem is
that this application worked fine in W2000. But the client change to
XP, and from that get this error.
This problem show when try to read from a table of Access XP.
Anybody knows why this happen now and not with W2000 ???

Its probably a permission issue with the database file.
 
G

Guest

Chad Z. Hower aka Kudzu said:
Its probably a permission issue with the database file.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu

Hi, I t hink it's not a permission issue, because the same user can open the
database and with windows 2000 the same program works fine.
I have tried it in my win XP and works fine. My XP have Office XP, and the
PC when don't work have Office 2003, can be this the problem ? I can belive
that this things happen.

This is the code.

Dim Miconsulta As OleDb.OleDbDataReader
'Crea la conexión
Try
BD = New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mybd.mdb")
Catch e As Exception
MessageBox.Show("Error al crear la conexión: " & vbCrLf &
e.message)
End Try

Dim cmd As OleDb.OleDbCommand
cmd = New OleDb.OleDbCommand("Select * from P_ListaArbol", BD)

Try
BD.Open()
Catch e As OleDb.OleDbException
Console.WriteLine("An exception occurred. Please contact
your system administrator.")
End Try

cmd.CommandType = CommandType.Text
Miconsulta = cmd.ExecuteReader()
While Miconsulta.Read()
......
 
C

Chad Z. Hower aka Kudzu

=?Utf-8?B?TmVncmk=?= said:
Hi, I t hink it's not a permission issue, because the same user can
open the database and with windows 2000 the same program works fine.
I have tried it in my win XP and works fine. My XP have Office XP, and
the PC when don't work have Office 2003, can be this the problem ? I
can belive that this things happen.

Its possible. JET is particully picky about versions, but its much better in recent years.

When you say the user can open the database, can they make modifications? Is the file read only?
 
G

Guest

Thanks for your answer
The file is not read-only, and the user can change data and the BD desing
The complete error is this:
System.InvalidOperationException: ExecuteReader requiere una conexión
abierta y disponible. El estado actual de la conexión es Closed.
at System.Data.OleDb.OleDbConnection.SetStateExecuting(OleDbCommand
attempt, String method, Boolean flag)
at System.Data.OleDb.OleDbCommand.ValidateConnectionAndTransaction(String
method, Int32& localState)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
.....
 
C

Chad Z. Hower aka Kudzu

=?Utf-8?B?TmVncmk=?= said:
System.InvalidOperationException: ExecuteReader requiere una conexi n
abierta y disponible. El estado actual de la conexi n es Closed.

Did you open the connection first? Or did you open it and soemthing else closed it?
 
G

Guest

Yes, I create the connection in this line:

Dim Miconsulta As OleDb.OleDbDataReader
Try
BD = New OleDb.OleDbConnection(Provider=Microsoft.Jet......;)
Catch e As Exception
MessageBox.Show(Error)
End Try

And open it in this:

Try
BD.Open()
Catch e As OleDb.OleDbException
Console.WriteLine(exception occurred...)
End Try
I think that can't open with a reason that i dont know.
 
C

Cor Ligthert

Negri,

This code that you show will never work, what is Error (withouth quotes) and
probably will the e give you direct an error because that is standard in
almost every sub or function for events. Therefore can you give us right
information.
Dim Miconsulta As OleDb.OleDbDataReader
Try
BD = New OleDb.OleDbConnection(Provider=Microsoft.Jet......;)
Catch e As Exception
MessageBox.Show(Error)
End Try

And open it in this:

Try
BD.Open()
Catch e As OleDb.OleDbException
Console.WriteLine(exception occurred...)
End Try
I think that can't open with a reason that i dont know.
Just my thought,

Cor
 
G

Guest

Hi Cor, you are right, this code will never work, i change it a little
because in internet browser, the quotes, a others symbols don't show right.
You can see almost complete code in my second message.
The code is in a private sub, not in a event sub.
 
R

Rogas69

Negri, I see that you use MessageBox in one exception handler and
Console.Writeline in the second. Maybe an exception IS thrown and you don't
see the message?

Peter
 
C

Cor Ligthert

Negri,

And you are sure that this line is not written. Why don't you change that to
a messagebox as well temporaly in the same way as you do in your first catch
(in the same way).

The error says it is not open, so if this onr fails, than you have the
reason.

Try
BD.Open()
Catch e As OleDb.OleDbException
Console.WriteLine("An exception occurred. Please contact
your system administrator.")
End Try


Cor
 
C

Cor Ligthert

Negri,

A little bit unreadable because I added more and more. I mean the line from
this procedure.
Console.WriteLine("An exception occurred. Please contact
your system administrator.")

Cor
 
C

Chad Z. Hower aka Kudzu

Cor Ligthert said:
And you are sure that this line is not written. Why don't you change
that to a messagebox as well temporaly in the same way as you do in
your first catch (in the same way).

Actually the msgbox might eb the problem. Where are you running this? As a webservice, or a
winforms?
 
G

Guest

Hello !!

My problem was that i was catching the exception in the line:
Try
BD.Open()
Catch e As OleDb.OleDbE
....
But i didn't see it.

Now if i don't catch the exception, i get this error in the bd.open:
0x800401F9 no error information...

Anybody Knows this error? The PC have Access 2003 and Win XP SP 1

Thanks
 
G

Guest

Hello !!

My problem was that i was catching the exception in the line:
Try
BD.Open()
Catch e As OleDb.OleDbE
....
But i didn't see it.

Now if i don't catch the exception, i get this error in the bd.open:
0x800401F9 no error information...

Anybody Knows this error? The PC have Access 2003 and Win XP SP 1

Thanks
 
G

Guest

Yes, I changed the catch instruction, but i don't know why, the program
didn't catch the exception and didn't show nothing in console, either with
messagebox.
Now i had clean the try - catch, and get this error when the program try
open database.
 
W

William \(Bill\) Vaughn

Could the operation be running on another thread?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
C

Cor Ligthert

Negri,

It shows up in visual studio.Net in the output box.

If you don't have that, than you can use on a webpage

(better is to change that e in ex, in dotNet the "e" has for most people the
meaning of "eventargument".

\\\
response.redirect("There was an error: " & ex.ToString)
///

It will than be written in top of your page in your browser.

I hope this helps,

Cor
 
G

Guest

I don't think so... is at the start of the program.
I need some information about the error 0x800401F9
 

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