Author Topic: HOw to automatically populate SQL database with weatherlink data  (Read 4847 times)

0 Members and 1 Guest are viewing this topic.

Offline WestMichigan

  • Member
  • *
  • Posts: 16
I am using weatherlink to populate data for my web page. I would like to be able to automatically take the uploaded data and add it to a SQL database. I know how to query the database, but how do I have it update everytime a new dataset is available?

Offline jruys

  • Yo
  • Senior Contributor
  • ****
  • Posts: 221
    • Highlands Ranch Weather
Re: HOw to automatically populate SQL database with weatherlink data
« Reply #1 on: January 17, 2008, 04:30:47 PM »
I populate a SQL database by using a Windows Service I wrote.  What it does is watch a the two day text download file (the one that you can have autogenerated by WeatherLink) and when it changes, I parse it and insert the new data into the SQL database.  Let me know if you want the source code for it (it was written in c#), and I can pop it out onto my web site.

Offline jruys

  • Yo
  • Senior Contributor
  • ****
  • Posts: 221
    • Highlands Ranch Weather
Re: HOw to automatically populate SQL database with weatherlink data
« Reply #2 on: January 23, 2008, 09:46:23 PM »
Below is a link to the code that will need to be modified to fit an individual machine (location of the downld02.txt file, the database connection string, and the fields you want inserted into the database) that can be used to insert WeatherLink records into SQL Server.  I set up an Internet Settings profile to download a 2 day report(downld02.txt) every 10 minutes.  The Windows Service watches for any changes to the downld02.txt file and runs code to insert the new records in a database.  You will probably need Visual Studio Standard 2003 or above to compile the code, unfortunately the Express versions will not work to compile the code.  If you would like, you can open the code up in an Express edition of c#, modify the code as you wish and send it to me to compile.

http://www.ruysfamily.com/WeatherDownloads/WeatherParserService.zip

Offline tinplate

  • Forecaster
  • *****
  • Posts: 368
    • http://www.softwx.com/products.html
Re: HOw to automatically populate SQL database with weatherlink data
« Reply #3 on: January 23, 2008, 10:12:13 PM »
What would stop C# Express from compiling it? The express versions can do quite a lot.

Offline jruys

  • Yo
  • Senior Contributor
  • ****
  • Posts: 221
    • Highlands Ranch Weather
Re: HOw to automatically populate SQL database with weatherlink data
« Reply #4 on: January 23, 2008, 10:51:59 PM »
I agree with you that the Express editions can do a lot, I use then frequently, but there is a service installer that the Express versions can not compile in the project that I posted.  I did try to open the project in C# Express, and it complained about a missing library.  So unfortunately that is one of the few things that is missing from the Express editions.  I did not try C# Express 2008 yet.  If anyone knows a way around the problem I would be happy to hear it.