September 30th, 2003, 09:19 AM
URGENT - Help me guys please ! I am in tr@#bl&*%#@!
So here is the bug that it's telling me
If I translate it :
Une exception non gérée du type 'System.InvalidOperationException' s'est produite dans system.data.dll
Informations supplémentaires_: ExecuteNonQuery requiert une connexion ouverte et disponible. L'état actuel de la connexion est Open, Fetching.
Here is a part of my code in the function where I am using that.
A exception have excaped, tye pof 'System.InvalidOperationException' occured in the system.data.dll
Other information : ExecuteNonQuery require an open and disponible connexion. It's state now is Open and Fetching
I bold and underlne where the bug occured.
If frmItems.OleDbConnection1.State <> ConnectionState.Open Then
'Connexion pour la requete
OleDBCommand.Connection = frmItems.OleDbConnection1
'Construit la requete
OleDBCommand.CommandText = "select * from adresse where noReleve = (select noReleve from releve where codeProjet = '" + NoReleve + "' )"
OleDataR = OleDBCommand.ExecuteReader
'Lit ligne par ligne les résultats trouvé, met dans un tableau
'et les met dans le listbox pour les afficher.
If OleDataR.Read() Then
Do 'Chaque ligne retourné lecture
'remet la valeur a false pour paser au prochain enreg.
bValide = False
For iCompteur = 0 To (tabRueNumero.Length - 1)
If OleDataR.Item("noRue") = tabRueNumero(iCompteur) Then
'ville a été trouvé donc ne supprime pas
bValide = True
'Pas besoin de rajouter cette ville dans les adresse
tabRueValide(iCompteur) = True
Exit For 'sort de la loop
If bValide = False Then
'Connexion pour la comm effacer et création de la requête
OleDBComEffacer.Connection = frmItems.OleDbConnection1
OleDBComEffacer.CommandText = "Delete adresse where (norue = '" & _
OleDataR.Item("norue") & "') and (noreleve = " & _
"(select noreleve from releve where codeprojet = '" & _
NoReleve + "'))"
Loop Until Not OleDataR.Read
I hope someone can help me cause I don't know what to do anymore !
Last edited by Watever; September 30th, 2003 at 10:52 AM.
September 30th, 2003, 03:41 PM
Trying hard to translate issue!
It sounds like you are trying it implement some sort of COM object into your code. If so, it looks like the connection strings you are using are not any good. Something like, it's open but cannot close (dispose). You are trying to manage the connectivity, but in .NET you do not have too.
I may be way off on this, but I do not speak or read spanish. And I'm trying to associate it with some common issues. If you need code on the implementation of a COM object, please let me know more about your platform and what the object was written in.
September 30th, 2003, 03:42 PM
or French for that matter.... (what language is it?)
September 30th, 2003, 04:56 PM
yeah it's damn CALIS D'OSTIE de French
lol, I work for a french canadian company and I am a french canadian too, that's why my written language in english is just soo bad !
What I am trying to do is to delete some information in the database that I don't need anymore, and that have been changed.
For that, I have a query that find me all the rows that refer to a document, then I compare them with the ones that are in a combobox. If the item is not in the combobox then I delete them.
and then it's continu to read the result from the query to compare them with the combobox items and again delete the ones that are not necessary.
I hope you understand what I am talking about ?
and what is a COM ? I don't know if that's what I am trying to do or not, I just don't know what's that.
but I beliee what I am doing is pretty simple. I tought
May be there is another way to delete the items I want to ? I tryed using a dataset and datarow but that was way too long cause I couldn't make a query in it and that's really slow when you have a lot of items in it cause you need to read all of them to find the ones you don't need. And when I tryed to delete more then 1 items it's bugged. soo that's why I reformulated in this one.
So if that one works, it's should be way faster imo.
I hope you can help me and that I gave you the information to you so you can help me.
September 30th, 2003, 06:03 PM
Your problem is at the very end, with the Execute method. Instead of calling it on OleDBComEffacer you called it on OleDBCommand.
I'm not sure, but you might want to set strict=on in your file. It might have caught this error.
Articles and commentary on web development
October 1st, 2003, 10:13 AM
ClayDowling : yeah you are right on that.
But my main problem then is that it's telling me that I already have a datarow associated with that connection.
Is it possible that you can't have 2 dataread working at the same time ?
Cause I only have 1 but when you use the OleDbComEffacer.ExecuteNonQuery, that will "in theory" return you a dataread information. Might it be my problem ?
Then I would need to close the other one. But how does I continu to read in the table then ? I need to do all the function again in a loop ? I would be loosing time and what I want to do at first.
2 session ?
October 1st, 2003, 10:42 AM
You're probably working off a server-side dataset. With most database engines, using a server-side dataset does tie up the connection pretty well.
You have two options: create another connection for removing records, or use a client-side dataset and take the performance hit. This doesn't look like the sort of code that gets run every hour on the hour, so the performance hit shouldn't be too bad. How big is the dataset that you're pulling down, anyway?
Articles and commentary on web development
October 1st, 2003, 11:12 AM
yeah it's not something that is always running etc...
soo I just decided to take a real easy way. I just created a dynamic table where I will add the information I need. And when the oledataread is ended, just read them and delete my information. So that way I won't have 2 running at the same time.
It's gonna take a little bit more time and it's not a good way to do it. But I want to finnish fast to go on something else. And the program isn't really big and it's for us so doesn't matter .
the only thing that might happen is that the girl who is using it will come and see me about something, and she is cute so it's ok.
now just need to find how the dynamic tables work in vb.net and I will be set.