Solved

Error, invalid operation, connection closed

Posted on 2007-11-23
2
2,935 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
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now