System.InvalidOperationException: ExecuteReader: Connection property has not been initialized

Discussion in 'ASP .Net Web Services' started by Antoni Massó Mola, Jun 18, 2004.

  1. Hello, I dont understand whats going on with my DB2 connector. I used to
    have the code in a class that worked fine. But when I tried to use it in a
    webservice I get this error: System.InvalidOperationException:
    ExecuteReader: Connection property has not been initialized.

    1) I create and open a new OleDbConnection
    adoConn adoConn = new adoConn();
    adoConn.Run("INTRANET");

    2) I execute the query
    OleDbDataReader myReader = adoConn.dbSQLSelect("Select * from USERS");

    ERROR

    Line 47: myReader = myCommand.ExecuteReader();


    What might be the problem?
     
    Antoni Massó Mola, Jun 18, 2004
    #1
    1. Advertising

  2. --------------------
    >From: "Antoni Massó Mola" <>
    >Subject: System.InvalidOperationException: ExecuteReader: Connection property has not been initialized
    >Date: Fri, 18 Jun 2004 12:14:49 +0200
    >
    >Hello, I dont understand whats going on with my DB2 connector. I used to
    >have the code in a class that worked fine. But when I tried to use it in a
    >webservice I get this error: System.InvalidOperationException:
    >ExecuteReader: Connection property has not been initialized.
    >
    >1) I create and open a new OleDbConnection
    >adoConn adoConn = new adoConn();
    >adoConn.Run("INTRANET");
    >
    >2) I execute the query
    >OleDbDataReader myReader = adoConn.dbSQLSelect("Select * from USERS");
    >
    >ERROR
    >
    >Line 47: myReader = myCommand.ExecuteReader();
    >
    >
    >What might be the problem?
    >

    hi Antoni,

    It might be because the connection property of the command was null when trying to execute the SQL
    command. If you are using COM components, try recompiling and registering them as well.

    Hope that helps,

    Michelle

    ***Disclaimer: This posting is provided "as is" with no warranties and confers no rights.***
     
    Michelle Hlaing, Feb 24, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MattB
    Replies:
    3
    Views:
    54,732
    nada111
    Oct 4, 2007
  2. CJM
    Replies:
    2
    Views:
    4,511
  3. Laura K
    Replies:
    12
    Views:
    44,424
    brenk
    May 15, 2010
  4. phil
    Replies:
    4
    Views:
    7,683
  5. RAM
    Replies:
    0
    Views:
    577
Loading...

Share This Page