Solved

Error, invalid operation, connection closed

Posted on 2007-11-23
2
2,945 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

838 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