title: Search Excel sheet from ASP.NET C#
body: <p><strong>UPDATE:</strong>
  I have found that this code works!  it searches the Excel sheet and only outputs the data I need.
  But can anyone explain to me why this works?  how does it know that the first line in the spreadsheet is the "index"??</p>
  
  <pre><code>    //Coneection String by default empty  
      string ConStr = "";  
      //connection string for that file which extantion is .xlsx  
      ConStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + "C:\\TestExcel.xlsx" + ";Extended Properties='Excel 12.0 XML;HDR=YES;';"; 
      //making query  
      string query = "SELECT * FROM [lol$] where ID='i2200'";  
      //Providing connection  
      OleDbConnection conn = new OleDbConnection(ConStr);  
      //checking that connection state is closed or not if closed the   
      //open the connection  
      if (conn.State == ConnectionState.Closed)  
      {  
          conn.Open();  
      }  
      //create command object  
      OleDbCommand cmd = new OleDbCommand(query, conn);  
      // create a data adapter and get the data into dataadapter  
      OleDbDataAdapter da = new OleDbDataAdapter(cmd);  
      DataSet ds = new DataSet();  
      //fill the Excel data to data set  
      da.Fill(ds);  
  
  foreach (DataRow row in ds.Tables[0].Rows)
  {
      lblud.Text = "" + row["Hylde"];
  }
  </code></pre>
  
  <p><strong>OLD</strong>
  I have been trying to do this for several hours now but no matter what i try, I don't end up with the result i want.</p>
  
  <p>So now im "starting from scratch" again. See if I have approached this incorretly.</p>
  
  <p>Question:
  I wan't to create a ASPX website that can search my excel sheet for specific data.
  Something like <code>Select * from [Sheet1$] where Column A = i2200</code></p>
  
  <p>then display only Column B and C from that specific row into a Label / two labels.
  See picture here: <a href="http://itguruen.dk/EXCEL.png" rel="nofollow">http://itguruen.dk/EXCEL.png</a> </p>
  
  <p>Does anyone have a simple way of doing this?
  Thanks in advance!</p>
  
  <p>Jasper </p>