Operation not valid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • N! Xau

    #1

    Operation not valid

    Ciao,

    Hi,
    a datagrid on my form displays a table T, fine.
    On the form I have a button. I want to execute a query on T, just
    clicking that button.
    DB is Oracle. Button_Click code is:

    ....
    Dim QSele As String = "select field1 from T"
    Dim mycmd As New OracleCommand(Q Sele, con)
    mycmd.CommandTy pe = CommandType.Tex t
    Try
    mycmd.ExecuteNo nQuery() '
    Catch ex As Exception
    MessageBox.Show (ex.Message)
    Finally
    mycmd = Nothing
    End Try

    At line mycmd.ExecuteNo nQuery I get an error:
    "Operation is not valid due to the current state of the object"


    Qualcuno puo' aiutarmi? Ciao,


    in una datagrid su un form visualizzo correttamente il contenuto di una

    tabella T.
    Accanto c'e' un bottone, cliccando sul quale voglio eseguire una query
    sulla stessa tabella.
    Il database e' Oracle, all'inizio della mia classe ho la riga:
    Imports Oracle.DataAcce ss.Client


    Il codice del click del bottone e':


    ....
    Dim QSele As String = "select field1 from T"
    Dim mycmd As New OracleCommand(Q Sele, con)
    mycmd.CommandTy pe = CommandType.Tex t
    Try
    mycmd.ExecuteNo nQuery() '
    Catch ex As Exception
    MessageBox.Show (ex.Message)
    Finally
    mycmd = Nothing
    End Try


    Quando il programma esegue mycmd.ExecuteNo nQuery ho l'errore:
    "Operation is not valid due to the current state of the object"

    Anybody can help? Thanks

    N! Xau

Working...