ASP Net - ExecuteReader: Connection property has not been initialized

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mamtaid
    New Member
    • Apr 2010
    • 2

    ASP Net - ExecuteReader: Connection property has not been initialized

    i have the following code....
    it gives the error::ExecuteR eader: Connection property has not been initialized

    can anyone please help me

    Code:
      sst = new DataSet();
                   
      asq = new OleDbCommand("select family_id from family where WHERE family_code = '" + Session["xx"].ToString() + "' ",con);
      //asq.Connection = con;
      asq1 = asq.ExecuteReader();
      while(asq1.Read())
      {
        sst.ExtendedProperties["id"]= asq1[0].ToString();
      }
      asq1.Close();
      //return sst;
      Label19.Text = sst.ToString();
    Last edited by Frinavale; Apr 27 '10, 03:50 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Well, as the error has stated, you have not set the connection.

    Please review the following article that outline how to use a database:
    Database tutorial Part 1
    Database tutorial Part 2

    -Frinny

    Comment

    Working...