.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 30th, 2003, 08:19 AM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
URGENT - Help me guys please ! I am in tr@#bl&*%#@!

So here is the bug that it's telling me

Code:
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.


If I translate it :
Code:
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


Here is a part of my code in the function where I am using that.
Code:
If frmItems.OleDbConnection1.State <> ConnectionState.Open Then
            frmItems.OleDbConnection1.Open()
        End If

        '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
                    End If
                Next

                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 + "'))"
                    OleDBCommand.ExecuteNonQuery()

                End If

            Loop Until Not OleDataR.Read


I bold and underlne where the bug occured.


I hope someone can help me cause I don't know what to do anymore !
__________________

Last edited by Watever : September 30th, 2003 at 09:52 AM.

Reply With Quote
  #2  
Old September 30th, 2003, 02:41 PM
emladris emladris is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: SC
Posts: 26 emladris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy 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.

Good luck!

Reply With Quote
  #3  
Old September 30th, 2003, 02:42 PM
emladris emladris is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: SC
Posts: 26 emladris User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking

or French for that matter.... (what language is it?)

Reply With Quote
  #4  
Old September 30th, 2003, 03:56 PM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
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.

Reply With Quote
  #5  
Old September 30th, 2003, 05:03 PM
ClayDowling ClayDowling is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Flint, MI
Posts: 328 ClayDowling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 25 sec
Reputation Power: 11
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.
__________________
Clay Dowling
Lazarus Notes
Articles and commentary on web development
http://www.lazarusid.com/notes/

Reply With Quote
  #6  
Old October 1st, 2003, 09:13 AM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
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 ?

Reply With Quote
  #7  
Old October 1st, 2003, 09:42 AM
ClayDowling ClayDowling is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Flint, MI
Posts: 328 ClayDowling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 25 sec
Reputation Power: 11
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?

Reply With Quote
  #8  
Old October 1st, 2003, 10:12 AM
Watever Watever is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Montreal, Canada
Posts: 486 Watever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 20 sec
Reputation Power: 10
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Help me guys please ! I am in @#¤¤%

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap