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

  • Question

  •       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

    Saturday, August 11, 2012 3:27 AM

Answers

  • 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)

    Tuesday, August 14, 2012 3:39 PM

All replies

  • Select D from [Sheet2$]

    Should work fine.

    Lingaraj Mishra

    Sunday, August 12, 2012 3:52 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

    Sunday, August 12, 2012 5:30 AM
  • 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


    Monday, August 13, 2012 2:01 AM
    Moderator
  • 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)

    Tuesday, August 14, 2012 3:39 PM