• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • 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

  • 2
1 Solution
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.
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.
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:
VS2005 Express:

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

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