2014-07-29 09:15
浏览 42


I have about 5000 csv file and I want to insert them in a sql server 2008 database.

I don't whether windows application or web application is better.

each csv file is simple a one row with 36 column that will be inserted in an one table in the database.

thanks for your help.

Update 1

This application will be used on a computer that can connect to the database, it is used by the admin just once, in order words, there are people who responsible to write these csv files, then all the files, come to me and I have to insert them in the database

Update 2

Thanks for the user who are trying to help me.

You gave me these options:

  1. bcp

  2. SqlBulkCopy

  3. Windows service

what is the best please? I told you all the requirements, which are very simple.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • drkwpgrdb092239314
    drkwpgrdb092239314 2014-07-29 09:18

    Depends how you want to use it - if you want to deploy to lots of people so they can upload a file and process it into a database, make it web.

    If on the other hand, you only have a couple of users which you can easily deploy an app to, there is a lot less infrastructure required to write it as an app.

    Sounds to me, you want to automate the mass loading of lots of files, so windows app is jumping out at me.

    All depends on what the overall requirements are.

    Based on your edit, write a win app that uses a folder enumeration, reads the records and passes to a SqlBulkCopy object.

    点赞 评论
  • douyao3895
    douyao3895 2014-07-29 09:41

    based on your comment I would take an aproach like that:

    Easy to use gui solution: 1. Make a website for people that are making the csv's

    1. That website would preform and check's that are necesery and display any errors. Error checking is done by the Web service (more future proven imo).
    2. Create a webservice importing the file to database and sending you an email. That way you don't have any work with putting the data into the database
    3. Implement an aproveal mechanism so you need to aprove the new inputs to the database if needed

    Easy to implement solution:

    1. Create an application (Console/WinForm/Web) that uses the bcp tool to import the data and handles errors
    点赞 评论