Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. help rqd with serverversion ... executeNonquery

help rqd with serverversion ... executeNonquery

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-net
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haseeb_saeed
    wrote on last edited by
    #1

    hello.. i am developing an application in asp.net using c# and am getting an error in the command.executenonquery method which throws an exception that the executenonquery requires an open and active connection though just above the call to executenonquery method i have opened the connection as connection.open where connection is a property that gets the connection which has been made from configurationmanager.connectionstring... I know there is no problem with connectionstring coz i have tried executereader and it works fine... To my knowledge the error has something to do vith serverversion... coz when i run the executereader and check the connection object over there, the connection state is open but when i run the nonquery then the connection object shows in its serverversion the follwing string "ServerVersion = 'command.Connection.ServerVersion' threw an exception of type 'System.InvalidOperationException'" Plz note that state of connection is closed even after i call the connection.open method... Plz provide help

    haseeb

    C 1 Reply Last reply
    0
    • H haseeb_saeed

      hello.. i am developing an application in asp.net using c# and am getting an error in the command.executenonquery method which throws an exception that the executenonquery requires an open and active connection though just above the call to executenonquery method i have opened the connection as connection.open where connection is a property that gets the connection which has been made from configurationmanager.connectionstring... I know there is no problem with connectionstring coz i have tried executereader and it works fine... To my knowledge the error has something to do vith serverversion... coz when i run the executereader and check the connection object over there, the connection state is open but when i run the nonquery then the connection object shows in its serverversion the follwing string "ServerVersion = 'command.Connection.ServerVersion' threw an exception of type 'System.InvalidOperationException'" Plz note that state of connection is closed even after i call the connection.open method... Plz provide help

      haseeb

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Well, it's obvious that your code is broken, or your database server is broken. Seeing your actual code would go a long way to helping us comment on it.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      H 2 Replies Last reply
      0
      • C Christian Graus

        Well, it's obvious that your code is broken, or your database server is broken. Seeing your actual code would go a long way to helping us comment on it.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        H Offline
        H Offline
        haseeb_saeed
        wrote on last edited by
        #3

        oh hello i am trying to insert a record to a table... the executenonquery gives the error that an open connection is rqd... when i replace the same comand with a selectcommand and the method to executereader it works but when its with executenonquery, it doesnt work

        haseeb

        1 Reply Last reply
        0
        • C Christian Graus

          Well, it's obvious that your code is broken, or your database server is broken. Seeing your actual code would go a long way to helping us comment on it.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          H Offline
          H Offline
          haseeb_saeed
          wrote on last edited by
          #4

          hello mr. Graus I have pasted the code... I am sorry ... Actually i didnt follow u by writin in the other message.. I thought that was a reply to my message and wrote there... Then i realized and pasted the same text in my message area... Also i wasn't online from my pc at that moment and couldnt send in the code... now i got a chance and pasted my code.... Best regards haseeb

          haseeb

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups