locked
SqlDataReader error RRS feed

  • Question

  • User1048318187 posted

    I get  a  'System.Data.SqlClient.SqlConnection' does not contain a definition for 'ExecuteReader' and no extension method 'ExecuteReader' compilation error , it is pointing to executeReader command :

    string qsho = Request.QueryString["sho"];
    SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);

    SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM  emailpages where item ='" + qsho + "'", con);

    DataTable dt = new DataTable();
    da.Fill(dt);
    showform.DataSource = dt;
    showform.DataBind();
    /// datareader to get headr and item names
    SqlDataReader rdr = con.ExecuteReader();

    rdr.Read();
    string rItem;
    rItem = rdr["item"];

    ...then later i will use that item field to display on a few areas of the page i need

    thanx for help
    Chumley

    Friday, September 11, 2015 11:47 AM

Answers

All replies