Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error, invalid operation, connection closed

Posted on 2007-11-23
2
Medium Priority
?
2,950 Views
Last Modified: 2012-06-27
Why do i get this error now?

I dont see anything wrong

error explanation in code below
Me.ListViewstatus.Clear()
        Dim forbindelse1 As New System.Data.OracleClient.OracleConnection
 
        forbindelse1.ConnectionString = "*****"
        forbindelse1.Open()
 
        Dim kommando As New System.Data.OracleClient.OracleCommand("select vare_navn, lagerstatus, lev_navn FROM vare ORDER BY lagerstatus")
        Dim dataleser As OracleClient.OracleDataReader
        dataleser = kommando.ExecuteReader()-----------------> Invalid operation connection closed
 
        With Me.ListViewstatus
            .GridLines = True
            .MultiSelect = False
            .FullRowSelect = True
            .View = View.Details
            .HideSelection = False
            .Columns.Add("Leverandør", 100, HorizontalAlignment.Center)
            .Columns.Add("Varenavn", 100, HorizontalAlignment.Center)
            .Columns.Add("Lagerstatus", 55, HorizontalAlignment.Center)
 
 
 
        End With
 
        Dim lstItem As ListViewItem
        While dataleser.Read()
            lstItem = New ListViewItem()
            lstItem.Text = dataleser.GetString(2)
            lstItem.SubItems.Add(dataleser.GetString(0))
            lstItem.SubItems.Add(dataleser.GetInt32(1))
 
 
            Me.ListViewstatus.Items.Add(lstItem)
 
 
        End While
 
        dataleser.Close()
        forbindelse1.Close()

Open in new window

0
Comment
Question by:leeds2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 20338562
I think you need:
        Dim kommando As New System.Data.OracleClient.OracleCommand("select vare_navn, lagerstatus, lev_navn FROM vare ORDER BY lagerstatus", forbindelse1)
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 20338566
The command also needs a connection.....
        forbindelse1.ConnectionString = "*****"
        forbindelse1.Open()
 
        Dim kommando As New System.Data.OracleClient.OracleCommand("select vare_navn, lagerstatus, lev_navn FROM vare ORDER BY lagerstatus", forbindelse1)
        Dim dataleser As OracleClient.OracleDataReader
        dataleser = kommando.ExecuteReader()

Open in new window

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question