How can I reffer a column in my query when using excel old db provider?

Answered How can I reffer a column in my query when using excel old db provider?

  • Saturday, August 11, 2012 3:27 AM
     
     

          May be the most basic question but I got stuck when during data generation data bound process I have to reffer to a specific column say D in my Sheet2. I can get all Columns in Sheet2 by using Select * from [Sheet2$] but when I have to reffer to Column D I tried Select D$ from Sheet2$ but it did not work.

         Can anyone tell me what should be the exact syntext?

    Nilkanth S. Desai

All Replies

  • Sunday, August 12, 2012 3:52 AM
     
      Has Code
    Select D from [Sheet2$]

    Should work fine.

    Lingaraj Mishra

  • Sunday, August 12, 2012 5:30 AM
     
     

    Hello Mishraji,

          Thanks for your reply. I try u r suggestion with one more alternative also as Select D$ from [Sheet2$] but it did not work. Thanks for u r answer.

    Nilkanth S. Desai

  • Monday, August 13, 2012 2:01 AM
    Moderator
     
     

    Hi Nikanth,

    Welcome to MSDN Forum.

    @Lingaraj's solution should work, is there an exception thrown, or the data isn't your expected?

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us


  • Tuesday, August 14, 2012 3:39 PM
     
     Answered
    If you are not using a header in the Excel Worksheet to identify the column names, then the default column names are F1, F2, F3, etc.

    Paul ~~~~ Microsoft MVP (Visual Basic)