OracleDataReader: Operation is not valid due to the current state of the object

Hi all

I am new to using libraries and oracle development tools. I have a project in vb 2010 began when I use the oracleDataReader to read data from my db (10g). by using the following code:

Oradb As String = "xxxxxxxxxxx".
Dim conn As New OracleConnection (oradb)
Conn. Open()

Dim test (1000) As String
Dim counter As Integer = 0
Dim cmd As New OracleCommand

Connection group conn cmd.
cmd.CommandText = "table FROM SELECT column where otherColumn > 21 June 11 '.
cmd.CommandType = CommandType.Text
Var as OracleDataReader dr = cmd. ExecuteReader()
Dr. Read()
test (Counter) = Dr. GetString (0)
While Dr. Read()
test (Counter) = Dr. GetString (0)
Counter = counter + 1
Loop

cmd ExecuteReader().
cmd.CommandText = "SELECT FROM table where otherColumn > 21 June NewColumn 11'"
Dr. Read()
test (Counter) = Dr. GetString (0)


How could change the cmd.CommandText to run new queries? As it is the second command dr.read throws the following error: "operation is not valid due to the current state of the object.

I found stating an another OracleDataReader object will allow me to run another query, I guess that there is a better way to "reset" State of the object first, as opposed to the creation of any new object each time I need to reset the command text.


Any ideas are greatly appreciated. Do not forget that I am new to coding, so I know the real C could be cleaned.

Thank you
...
cmd.CommandText = ""
dr = cmd.ExecuteReader()
dr.Read()
... etc ...

It will be useful,
Greg

Tags: Database

Similar Questions

  • Game-CDDrive operation is not valid due to the current state of the object.

    It's been a while, please remind me how to put the code here? PSVersion 5.0.10105.0 VMWare PowerCLI AutoDeploy component 6.0 build 2358282 VMWare ImageBuilder PowerCLI component 6.0 build 2358282 license of VMware PowerCLI component 6.0 build 2315846 VMware vSphere PowerCLI component 6.0 build 2548068 VMware VDS PowerCLI component 6.0 build 2548068 Cloud of VMware Infrastructure Suite PowerCLI component 6.0 build 2548068 VMware HA PowerCLI component 6.0 build 2510422 VMware PowerCLI component Storage Management 6.0 build 2522368 trying to build a server from the ground using Powercli. Started with:

    $paramVM = @{

    VMHost =   $vmhost

    Version =   "v7"

        Name  =   "CompVM"

    Data store = $datastore

    DiskGB =   50

    DiskStorageFormat = "EagerZeroedThick"

    MemoryGB =   4

    NumCpu =   1

    Location =   $Folder

        CD  =   $true

    ResourcePool = $ResourcePool

    PortGroup = $portGroup

    Notes = "DC of DOM"

    Confirm =   $false

    }

    $paramVM . Location | select *

    New-VM @paramVM

    It seemed to go very well.

    Get-VM svr01mid100 | Start-VM

    Then, something isn't quite right.

    $paramNA = @{

    StartConnected =   $true

    WakeOnLan =   $true

    Connected =   $true

        Type  = « Vmxnet3 »

    Confirm =   $false

    }

    Get-VM chi01osm300 | Get-NetworkAdapter | Set-NetworkAdapter @paramNA

    , I get the error: Set-NetworkAdapter: 29/07/2015-18:44:36 Set-NetworkAdapter operation is not valid due to the current state of the object. Online: 9 char: 43 + Get - VM svr01mid100 | Get-NetworkAdapter | Together-NetworkAdapter @paramNA + ~ ~ ~ + CategoryInfo: NotSpecified: (:)) [game-NetworkAdapter], VimException + FullyQualifiedErrorId: Core_BaseCmdlet_UnknownError, VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.SetNetworkAdapter MacAddress: 00:10:56:ss:3f:ab WakeOnLanEnabled: true NetworkName: SameAsAbove Type: Vmxnet3 ParentId: VirtualMachine - vm - 108361 Parent: svr01mid100 Uid: /VIServer = Dom\[email protected]: 443/VirtualMachine = VirtualMachine-vm-108361/NetworkAdapter = 4000 / ConnectionState: logged, NoGuestControl, StartConnected ExtensionData: VMware.Vim.VirtualVmxnet3 Id: VirtualMachine-vm-108361/4000 name: NIC 1 Client: VMware.VimAutomation.ViCore.Impl.V1.VimClient )

    Get-VM svr01mid100 | Get-CDDrive | Select Name,IsoPath

    Name IsoPath - CD/DVD drive 1 C:\ PS > Get - VM svr01mid100 | Get-CDDrive. Game-CDDrive - IsoPath $isoPath - StartConnected $true - confirm: $false Set-CDDrive: 29/07/2015-18:50:39 Set-CDDrive operation is not valid due to the current state of the object. I disconnected and then reconnected my session. I tried to see what was going on in vCenter (which I never do) and I fount it tries to start with the ISO, but giving a frown face and reboot again. I think that he did not like something in the build of the server. Help!

    I don't know that I did it is clear enough. The new VM script seems to work, it creates a new virtual machine.

    But eventually, every setting change that I try to do on the virtual machine, I get an error stating that "the operation is not valid due to the current state of the object."

    It seems to take the configuration but then I noticed he tried to start, but it started getting the error that I put in the screenshot.

    To me, that shows that it is trying to boot from the CD, because it is a Windows error.  Moreover, he just trying to start several times.

    Now, I went back and I think that the error "operation is not valid due to the current state of the object" may have been the fact that the VM tried to boot from the CD over and over, this is what is meant by the current state.

    I noticed just here, the hosts have 4.1 on them, which does not support r2 Server 2012.

    I think we're good.  Thank you!

  • ERROR: New-Snapshot (the operation is not valid due to the current state of the object)

    Hello guys!

    I've been googlin everywhere, but impossible to find a solution to my problem. I hope that one of you, qualified people can point me in the right direction :)

    I created a powerCLI script to take a snapshot of our most important servers before we do our weekly maintenance. The idea to run the script as regular powershell script and then have

    1. Add snap-ins powercli and connect to virtualcenter servers
    2. ask the VC servers to virtual machines in a perticular folder
    3. Loop foreach on these servers to create a snapshot with the name $snapshotname

    Currently, I just do it turn on a test folder that I created in vSphere that contains 3 test VMs:

    • Testmagne1 - normal operation
    • Testmagne2 - I renamed the folder for this virtual machine in the data store to generate an error.
    • testmagne3 - normal operation

    Since the servers (not the test servers, but good ones) is the most important servers in our environment, I want to be able to catch exceptions and errors when I run this script. I do this with the Try - Catch - Finally works.

    The strange thing is:

    The release of Powershell/PowerCLI is different from the output in VirtualCenter (!)

    In virtualcenter, the output is as follows

    • Testmagne1 - snapshot is created successfully - as expected
    • Testmagne2 - the snapshot creation fails because it cannot find the files .vmx - as expected
    • Testmagne3 - snapshot is created successfully - as expected

    However, the exit in powercli is slightly different:

    • Testmagne1 - snapshot is created successfully - as expected
    • Testmagne2 - creation of the snapshot fails because it cannot find the files .vmx - as expected
    • Testmagne3 - snapshot fails with the error message: operation is not valid due to the current state of the object - huh?


    Apparently once the first error is generated all succeeding VMs get error "the operation is not valid due to the current state of the object"


    I've been pulling trying to figure this problem on my hair, but I'm not getting anywhere


    Here is some additional information:

    1. the Script (abridged version of it. It generates the same error):

    -STARTUP SCRIPT-

    $ErrorActionPreference = "stop".

    Add-PSSnapin VMware.VimAutomation.Vds, VMware.VimAutomation.Core | Out-Null

    SE connect-VIServer VIRTUALCENTER1, VIRTUALCENTER2 | Out-Null # Sensored VirtualCenter names

    $servers = get-VM-location 'testfolder '.

    $snapshotname = 'Testsnapshot '.

    $verifycreatesnapshot = Read-Host "you are about to create snapshots for $servers. Do you want to continue? o/n.

    If ($verifycreatesnapshot - eq 'y') {}

    Write-Host "snapshots of creation...". »

    {ForEach ($i in $servers)

    Write-Host "instant Creation for $i."

    Try {new-Snapshot - VM $i - name $snapshotname |} Out-Null}

    Catch {$_.exception | select *;} Write-Host "Unable to create the snapshot for $i" ;}

    }

    Write-Host "command finished.

    }

    else {Write-Host "Operation canceled by user"}

    Read-Host "end of the script. Press ENTER to close. "

    ------------------ END SCRIPT -------------------

    2. the PowerCli error messages:

    Error for Testmagne 2 (as expected):

    File: [DATASTORE114] testmagne2/testmagne2.vmx

    DynamicType:

    DynamicPropertyInternal:

    FaultCause:

    FaultMessage:

    ErrorId: Client20_TaskServiceImpl_CheckServerSideTaskUpdates_O

    perationFailed

    ErrorCategory: NotSpecified

    TargetObject:

    RecommendedAction:

    SessionId:

    ConnectionId: /VIServer = SENSORED: 443 /

    Severity: error

    Message: 31/10/2013-10:52:16 New-Snapshot the operat

    ion for the entity 'testmagne2' failed with the follo

    the wing's message: "file [DATASTORE114] testmagne2/testmagn".

    E2.vmx was not found.

    Data: {ParameterValues}

    InnerException: VMware.Vim.VimException: exploitation of the entity

    'testmagne2' failed with the following message: 'thread '.

    testmagne2/testmagne2.vmx e [DATASTORE114] was not crazy

    ND ".

    TargetSite:

    StackTrace:

    HelpLink:

    Source:

    Failed to create the snapshot for testmagne2

    Error for testmagne3:

    Creation of snapshot for testmagne3

    ErrorId: Core_BaseCmdlet_UnknownError

    ErrorCategory: NotSpecified

    TargetObject:

    RecommendedAction: An error occurred when executing command: new-Snapshot. I have check

    f exception for more details.

    SessionId:

    Login ID:

    Severity: error

    Message: 31/10/2013-10:52:17 instant New-capture operation is not

    valid due to the current state of the object.

    Data: {ParameterValues}

    InnerException : System.InvalidOperationException: operation is not valid from

    e to the current state of the object.

    at VMware.VimAutomation.ViCore.Impl.V1.Task.ViCoreTaskCo

    reServiceProviderImpl.BeginTaskCompletionPoll (list 1 taskLi

    St)

    at VMware.VimAutomation.Sdk.Impl.V1.Task.CoreTaskService

    Impl.WaitForTask (IEnumerable 1 taskList, ProgressCallback p

    rogressCallback)

    at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdl

    and. EndProcessingErrorHandled()

    at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseC

    mdlet. EndProcessingErrorHandled()

    TargetSite: Sub ThrowTerminatingError (System.Management.Automation.Err

    orRecord)

    StackTrace: At System.Management.Automation.MshCommandRuntime.ThrowT

    erminatingError (ErrorRecord errorRecord)

    HelpLink:

    Source: System.Management.Automation

    Failed to create the snapshot for testmagne3

    3 PowerCLI version

    PowerCLI Version

    ----------------

    VMware vSphere PowerCLI 5.5 Release 1 build 1295336

    ---------------

    Versions of the snap

    ---------------

    VMWare AutoDeploy PowerCLI component 5.5 build 1262826

    VMWare ImageBuilder PowerCLI component 5.5 build 1262826

    License of VMware PowerCLI component 5.5 build 1265954

    VDS's VMware PowerCLI component 5.5 build 1295334

    VMware vSphere PowerCLI component 5.5 build 1295334


    4 VirtualCenter version

    VMware vCenter Server Version 5.0.0 Build 913577

    vSphere Client Version 5.0.0 Build 913577

    Hosts: VMware ESXi 5.0.0 Build 914586

    If you need additional information, let me know

    Any help is greatly appreciated

    Thank you!

    -Loincloth



    Definition - ErrorAction Stop locally on the cmdlet will not solve the problem. We have found and solved the problem and the fix will be available in the next version. Until then, you can use the $error variable to detect whether the cmdlet was successful or not. You can clear the $error variable before calling the cmdlet and check if it's still empty after the call.

  • Together-NetworkAdapter returning to "operation is not valid due to the current state of the object"

    I'm using fix - up all-NIC in the host servers when a portgroup is renamed.  Demand seems to make the required changes, then crashses.  I don't see any errors in the list recent tasks in vCenter.

    I use the following code:

    Get-VMHost vmware.host | Get - VM | Get-NetworkAdapter | Where {$_.NetworkName - eq "ancien_nom"} |  Together-NetworkAdapter - NetworkName "newname" - confirm: $false
    The error is:
    Together-NetworkAdapter: 17/10/2012 12:16:56 game-card network Operation is not valid due to the current
    State of the object.
    At line: 1 char: 114
    {"+... ancien_nom"} |  Together-NetworkAdapter - NetworkName "newname" - confirm: $false
    +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo: NotSpecified: (:)) [game-NetworkAdapter], VimException)
    + FullyQualifiedErrorId: Core_BaseCmdlet_UnknownError, VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.
    SetNetworkAdapter
    It's using PowerCLI 5.1 Release 1 against vCenter 5.0 and 5.0 ESXi.
    Any ideas how or tell you why it's a failure or repair.
    Thank you
    Iain

    No, you should not be a problem.

    Are you by chance using PowerGui?

    There were references to the exact same message when you use an older version of PowerGui and the PowerPack.

    See New - VM error (operation is not valid due to the current state of the object.)

  • With Move-VM error: operation is not valid due to the current state of the object.

    I only started shows after update to PowerCLI v5.1.  My vCenter is v5.0.  I saw this when moving virtual machines to a data store in a different data store cluster.  The task submits to vCenter successfully and ends, but the Move-VM errors and returns control to the script or command line that ran.

    $> Move-VM - VM somevm Datastore - somedatastore - confirm: $false
    Move-VM: 13/11/2012-16:07:45 operation Move-VM is not valid due to the current state of the object.
    On line: 1 char: 1
    + Move-VM VM - somevm - data somedatastore store - confirm: $false
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo: NotSpecified: (:)) [Move-VM], VimException)
    + FullyQualifiedErrorId: Core_BaseCmdlet_UnknownError, VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM

    I'm puzzled.

    Do you by chance have a PowerShell v2 available somewhere where you can run the same script?

    As much as I know there no official PS still in PowerCLI v3 support, although there are only a few known minor pitfalls.

    While clutching at straws

  • Switch to the correct encryption certificate I get the error: "Key not valid for use is specified state."

    Used
    Now cannot open encrypted files.

    When you try to pass the correct encryption certificate I get the error:
    "Key not valid for use is specified state."

    See this http://answers.microsoft.com/en-us/windows/forum/windows_7-security/keeping-passwords-secure-microsoft-policy-on/39f56ef0-5d68-41ad-9daa-6e6019c25d37

    It is as it's supposed to as an anti theft precautions. I mean that data is encrypted, if somebody stole your hard drive and the hard drive boots and the other account it can receive data.

    If you not export recovery certificates and encrypting the data, you cannot redo the decryption.

    http://Windows.Microsoft.com/en-us/Windows/back-up-EFS-certificate#1TC=Windows-7

    If it's a default domain recovery agent. admin area. If it's home, to look for recovery certified you have exported.

    But third-party tools are there if you can remember old password the is to encrypt you can recover. But they are not free... and premium software is not be recommended or guided through support free forum due to the effort of preventing unnecessary advertising.

    You can do you own research about recovering data... just try to get you using the favorite search engine... "Restore access to encrypted EFS format files" or "Advanced EFS Data Recovery.

    Many more free guides will be available... Just keep in mind this is not a method to escape... you must remember your old password at least for decryption in the case where you export a certificate.

  • Operation menu not valid

    Anyone know why it continues to be? It happens every time I Save a project - the project records very well, so why it reappear?

    Thank you.menu.jpg

    There seems to be a bug.  See here:

    Re: Error operation Menu not valid in CS6

    Invalid Menu operation alert bug still present

  • Operation could not be performed. The print spooler service is not running

    I get the error message "operation could not be performed. The print spooler service is not running. "How to start the service on Windows xp print spooler?

    Click Start--->run---> Type ' services.msc"--->OK and scroll down to print spooler entry and right-click, select Properties, set Startup type and in"service status", click the button to start the service."

    Good luck.

  • "Import the results of import operations have not been executed."   The following files were not imported because they could not be read

    Use Windows 10 and lightroom cc.

    All of a sudden I can't import pictures from my memory card.

    "Import results.

    Some import operations were not performed.

    The following files were not imported because they could not be read. »


    Anyone having the same problem

    Hi SwedishBirch,

    Make sure that the destination location is set correctly and has full read and write permissions.

    And make sure that the program is updated: keeping up-to-date for Lightroom

    Kind regards

    Claes

  • I've updated to LR6.4 today and since then have been unable to import photos.  Always comes the following message is displayed:-certain import operations have not been executed.  The following files were not imported because they could not be read.  I don

    I've updated to LR6.4 today and since then have been unable to import photos.  Always comes the following message is displayed:-certain import operations have not been executed.  The following files were not imported because they could not be read.  I don't change anything, update only.  I rebooted since my Mac Lightroom of uninstalled and reinstalled LR6 but all without success.  Very frustrated!

    Hi lindaw,.

    Looks like that the destination location is not set correctly.

    Make sure the destination in the import window location is set correctly and has full read and write permissions.

    Kind regards

    Claes

  • I own 13 element to Win and just got my Mac Book so I downloaded the Mac version of 13 items and trying my serial number, but get the message that this serial number is not valid (I type the exact Win serial number I have my account

    Hello

    I have 13 element to WIN and just got my MacBook so I downloaded the MAC version of 13 items and trying to allow my serial number, but the message that this serial number is not valid (I type the exact Win serial number I have my account on the Adobe website)

    Since version 13 is no longer marketed, I will assume that you are since long TIME 30 days return policy

    You'll have to buy version 14 for your Mac... or install a software emulation to then run your program Windows on a Mac

  • When I entered my serial number to activate Photoshop CS4, it said that the number is not valid. However, the customer service Adobe told me that the number is valid. What should I do?

    When I entered my serial number to activate Photoshop CS4, it said that the number is not valid. However, the customer service Adobe told me that the number is valid. What should I do?

    Error "serial number is not valid for this product". Creative Suite

  • Registration for the web function has stopped working in my copy of photoshop elements 12.  I get this message "the operation could not be completed.  The system cannot find the path specified"reset preferences was not fixed.

    Registration for the web function has stopped working in my copy of photoshop elements 12.  I get this message "the operation could not be completed.  The system cannot find the path specified"reset preferences was not fixed.

    My os is windows 7.  elements of 12 worked fine for several months and then save for web stopped working

  • key not valid for use in a State specified when executing install_reader11_en_mssd_aaa_aih

    After the download, the Version XI (11.0.08)

    to

    http://get.Adobe.com/reader/download/?installer=Reader_11.0.08_English_for_Windows & os = Wind UX % 207 & browser_type = KHTML & Chrome = browser_dist & d = McAfee_Security_Scan_Plus_Chrome_Browser & dualoffer = false

    running and installation of _reader11_en_mssd_aaa_aih

    I get ".

    Adobe reader Setup error

    key not valid for use in specified state

    You use Windows 7, try google chrome and firefox browsers

    report of the system that was created but could not send

    Hey Geri,

    Acrobat X does not support this platform. In some cases, the product works on unsupported platforms, but this probably isn't one of those cases.

    http://www.Adobe.com/products/acrobatpro/tech-specs.html#x

    Ben

  • 'Operating system not found', can't the recovery partition, do not have a recovery disk

    Original title: recovery Partition not here and not backed up copy of Win8

    I have an 18 month, Acer Aspire V5-571pg now out of warranty.  For the last 3 days, of what it has been in a loop bringing repair until this morning disc error messages, it just says "operating system not found '.  A call to Acer support and we have tried to activate the recovery Partition using Alt - F10 but it seems that the partition is not there either, and of course I did not create a recovery disk when I got the laptop.  I was not eager to send the Acer laptop for service after the warranty expires, I thought I should at least attempt of recovery or re - install.  Windows 8 is a preinstalled OEM version.  Where should I start?  Y at - he's going to be a download that I can use and what I need to know a product key to install?  Should I get Acer to send me a recovery disk?  Not super PC here but am knowledge letter wins all the time.  I hope someone understands my situation.  Thank you

    You can order the recovery media using your SNID, from the link below. I have an ACER desktop computer, and it cost me less than US$ 20.00, to order an additional series.

    eRecovery Media

    http://store.Acer.com/store/aceramer/en_US/eRecovery

Maybe you are looking for