• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Urgent - .NET Script for txt file to SQL table

Hello Experts.

I have the following problem.

I have some code which takes an input text file which is semi colon delimited. And converts it to SQL datatable.
The thing I want is to make this code as script so it will run every two hours.

The reason I want to do this is because the input text file will be updated every two hours. And I do not want to convert this txt to SQL manually. It should be automatic.

I have no idea how to achieve this? Is there a way I can create some script which will do this task ?
Open for any suggestions.

Hope I explained my question correctly.

Thank in advance

0
chinu1310
Asked:
chinu1310
  • 2
1 Solution
 
tpwellsCommented:
Quickest solution:

Create your script to run as an exe that takes a command line parameter, namely the sql file path and name. Set up a scheduled task to execute every 2 hours calling that exe and passing the sql file as the parameter.

Second Solution:

Turn your script into a windows service that will execute the procedure every two hours based on a timer object in the code.
0
 
chinu1310Author Commented:
Gr8! What I am suspicious about is my application is web application. How can I manage any of the above ideas to match with that.

I liked you second idea. Can you be more specific on that. If it is applicable to web applications.
Thanks for reply.
0
 
tpwellsCommented:
Windows services will not work for web application unless you code your script as a service or create a esrvice that launches your page but if you are going to do that you would be better off to schedule a task to launch the web page when you want it to run.

Two Tutorials that will help create a service:
 http://www.aspfree.com/c/a/C-Sharp/Creating-a-Windows-Service-with-C-Sharp-introduction/
 http://www.aspfree.com/c/a/C-Sharp/Timer-Objects-in-Windows-Services-with-C-sharp-dot-NET/
VS2005 Express:
 http://www.codeproject.com/cs/system/WindowsService.asp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now