none
Export an Excel File Using Visual Studio from Mysql Database RRS feed

  • Question

  • Hi everyone! 
    I came here for some help. :) 
    I am working on a proyect for my mom, I wanna help her with her secretary function in a school. So I am trying to make a program for making her taks more easy. 
    This program needs to EXPORT an excel file from a database, but i dont know how to do that. 

    If u need the code let me know , but you coud make an very easy example for me and i will apply that to my database. :)

    Using Visual Studio 
    Languaje : C# 
    Database server: MySQL 

    I try with Excel library but it seems is not working for >Office2007, so maybe you did that one day before so u could help me with that :). 

    That's all. Its gonna be so great If U know how. 
    Have a nice day to everyone.

    • Moved by lake Xiao Friday, July 29, 2016 5:11 AM
    Thursday, July 28, 2016 4:19 PM

Answers

All replies

  • Hi,

    Since Our forum is discussing about VS general question like how to set/configure Visual Studio and Visual Studio tools. And you question is more related to the ADO.NET dataset. I moved your thread to the corresponding forum for better support.

    Thanks for your understanding.

    Best Regards,

    Lake Xiao

    Friday, July 29, 2016 5:09 AM
  • Hi YeisonCaicedo_95,

    You could create a excel file and insert records into excel by using oledb.

    For Excel 97-2003 format Microsoft Jet OLEDB Driver 4.0 is used. A sample connection string as follows.
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book1.xls;Extended Properties='Excel 8.0;HDR=Yes'"

    Connection String for Excel 2007 Format (.XLSX)

    For Excel 2007 format the new Microsoft Ace OLEDB Driver 12.0 is used. A sample connection string as follows.

    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Book1.xlsx;Extended Properties='Excel 8.0;HDR=Yes'"

    And the following article provide a complete sample for your reference.

    http://www.aspsnippets.com/Articles/Export-Data-to-Excel-Sheet-using-ADO.Net-and-C.aspx

    In addition, we could also use OpenXML to achieve it. For more information about "Export to Excel" C# class, using OpenXML, please refer to:

    http://www.codeproject.com/Articles/692092/A-free-Export-to-Excel-Csharp-class-using-OpenXML

    Best regards,

    Cole Wu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, July 29, 2016 6:43 AM
    Moderator