none
oledb+excel RRS feed

  • 问题

  • i have a excel sheet [Data],and i want to insert some data in it;if it's column have titles like this ,i can use"Insert [Data$](D1,D2,D3) VALUES ({0},{1},{2}).....",but if it has no column name like "D1,D2...",how can i insert it?i tried "Insert [Data$A:C] VALUES ({0},{1},{2})...." ,but it throws exception.anyone helps me ? thank you very much!

    
    
    
    
    2014年8月8日 2:34

答案

  • 您好,
    Please Ref this,

    http://stackoverflow.com/questions/10223784/export-into-excel-file-without-headers-c-sharp-using-oledb

    If the connection string contains HDR=NO then the Jet OLE DB provider automatically names the fields for you (F1 for the first field, F2 for the second field, and so on). I will try to change your query in this way


    亂馬客blog: http://www.dotblogs.com.tw/rainmaker/

    • 已标记为答案 曹阳 2014年8月8日 6:25
    2014年8月8日 3:30

全部回复

  • 您好,
    Please Ref this,

    http://stackoverflow.com/questions/10223784/export-into-excel-file-without-headers-c-sharp-using-oledb

    If the connection string contains HDR=NO then the Jet OLE DB provider automatically names the fields for you (F1 for the first field, F2 for the second field, and so on). I will try to change your query in this way


    亂馬客blog: http://www.dotblogs.com.tw/rainmaker/

    • 已标记为答案 曹阳 2014年8月8日 6:25
    2014年8月8日 3:30
  • 您好,
    Please Ref this,

    http://stackoverflow.com/questions/10223784/export-into-excel-file-without-headers-c-sharp-using-oledb

    If the connection string contains HDR=NO then the Jet OLE DB provider automatically names the fields for you (F1 for the first field, F2 for the second field, and so on). I will try to change your query in this way


    亂馬客blog: http://www.dotblogs.com.tw/rainmaker/

    thank you,but i'm sorry,it doesn't work 
    2014年8月8日 5:41
  • 您好,
    Please Ref this,

    http://stackoverflow.com/questions/10223784/export-into-excel-file-without-headers-c-sharp-using-oledb

    If the connection string contains HDR=NO then the Jet OLE DB provider automatically names the fields for you (F1 for the first field, F2 for the second field, and so on). I will try to change your query in this way


    亂馬客blog: http://www.dotblogs.com.tw/rainmaker/

    yeah,it works.i miss one line just now
    2014年8月8日 6:25
  • thank you
    2014年8月8日 6:26