开发者

Automatically download and fill SQL Server table from .csv

So this site - http://www.stopforumspam.com/downloads/, has a file available for download containing IP addresses linked with spam accounts on the web.

I开发者_如何学Go have a table in my SQL Server database containing a list of blocked IP's for use with my comment system checking.

Is there anyway (or anything I can look into), to get my web app to go and download this file once a day at midnight, and re-fresh my table with the data in this .csv file?

Thanks guys.


I would probably use WebClient.DownloadFile as Stefan suggested, but I would create my own script to import the data. I have not used the application he referenced, but creating your own script allows you to validate the data before inserting it. You could also programatically check to see what has changed before inserting, and only insert new records.

Since you're using Azure, you can create scheduled tasks as described in this question: Azure - queueing time based tasks


You can use WebClient.DownloadFile to get the cvs on your server and then use code from this project to export your csv file to sql.

If you want the code that does the above operations to run each day, is better to create a windows service with a timer on service start that triggers every 24h. good luck

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜