How to export SQL table data to CSV (C# code)

Поділитися
Вставка
  • Опубліковано 6 лют 2025
  • This video shows how we can write C# code to export SQL table data to CSV file using DataReader object.
    Credit :
    Music : UA-cam Audio Library

КОМЕНТАРІ • 13

  • @markkane4220
    @markkane4220 Рік тому +1

    It would nice to have the source code it a file. I could have skipped the whole video.

  • @brunomotta26
    @brunomotta26 3 роки тому

    hello, is it possible to make two queries with this method and export in different sheets?

    • @codeandexecute-gsm
      @codeandexecute-gsm  3 роки тому

      Thanks for watching this video. This method is for CSV file. You can try to export your two tables' data to an excel in two different sheets. You can check my recent videos on exporting data to excel using ClosedXML or EPPlus.

    • @brunomotta26
      @brunomotta26 3 роки тому

      @@codeandexecute-gsm ok, i will look at them, thank you very much

  • @lmsweed
    @lmsweed 3 роки тому +2

    Exactly what I needed, thank you!

  • @vitn887
    @vitn887 2 роки тому

    Hey, I would love to change form of date export -> instead of dd.mm.yy to yy.mm.dd. And Numbers separate by . instead of ,
    Thanks for help. :)

  • @alexander112330
    @alexander112330 3 роки тому

    thx!

  • @mireq3461
    @mireq3461 2 роки тому +1

    Hi, for me it skips first row from the database (I suppose it is being replaced by header). How can I fix that?

    • @aethenwulf4757
      @aethenwulf4757 2 роки тому

      i have the same problem lol.
      (tell me how if you fix it please)

    • @aethenwulf4757
      @aethenwulf4757 2 роки тому

      bro i fix mine, if you wan't the answer just comment here again.

    • @SomeRandomPerson101
      @SomeRandomPerson101 Рік тому

      @@aethenwulf4757 I am now facing the same problem.
      How did you fix the error?

    • @aethenwulf4757
      @aethenwulf4757 Рік тому

      @@SomeRandomPerson101 i use while loop and add i++ inside. or delete the "if (DataReader.Read)" on header part