locked
How to select from Excel Sheet based on RowNumber RRS feed

  • Question

  • User365505212 posted

     help me in writing the Select Query based on the Row Number of Excel Sheet

    i have tried

     MyConnection = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;DataSource=C:\Users\sumit.a.choudhary\Desktop\ACE.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""");

    MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$] where Row_Num=3", MyConnection);


     But it is not working

    Please Reply in C#

    Monday, September 17, 2012 1:59 AM

All replies

  • User1410450975 posted

    you can run the query With Column value

    with where condition

    "select * from [Sheet1$] where EMP_ID=3"

    Monday, September 17, 2012 2:11 AM
  • User365505212 posted

    I agree ,

    But in my Sheet the column Values are repeated.

    Monday, September 17, 2012 2:37 AM
  • User1410450975 posted

    then you can use multiple condtion 

    Monday, September 17, 2012 4:29 AM