ComputerNovice
New member
- Joined
- Sep 18, 2013
- Messages
- 2
- Programming Experience
- 1-3
Hi,
I'm hoping to get a suggestion or more about a project. All comments welcome.
We have a simple database table, housed on a SQL Server, that holds inventory and location of physical servers. The contents of this database table is usually accessible by our team on an internal website.
Unfortunately, when our site or network is down, our team doesn't have access to this inventory. So we need a solution, when this happens.
I'm wanting to write a C# script, which will be executed from Control-M only once per day, that does the following:
1. Connects to the database and writes the contents of our inventory table (about 1100 records) to an Excel file (preferably csv file.
2. Saves this file to 4 different locations (3 user workstations and one network location).
3. Performs clean-up on files older than 3 days, in the targeted locations, to maintain folder space.
I'll be using Visual Studio 2010 to write the C# script.
Because this is an automated script, I certainly won't be writing a Windows Form Application. So, I'm assuming this script will be written as a Console Application project in Visual Studio? Problem is, I've never written a console app that connects to a database. Most of my labs in school were GUI apps, when connecting and working with databases. And I've certainly never written code that dumps or formats anything into an Excel file (I'm only familiar with doing that in Notepad).
What is the easiest way to connect to the database and pull the data through this automated script? Is it difficult to format the data into Excel?
Any and all suggestions would be appreciated. Thank you!
I'm hoping to get a suggestion or more about a project. All comments welcome.
We have a simple database table, housed on a SQL Server, that holds inventory and location of physical servers. The contents of this database table is usually accessible by our team on an internal website.
Unfortunately, when our site or network is down, our team doesn't have access to this inventory. So we need a solution, when this happens.
I'm wanting to write a C# script, which will be executed from Control-M only once per day, that does the following:
1. Connects to the database and writes the contents of our inventory table (about 1100 records) to an Excel file (preferably csv file.
2. Saves this file to 4 different locations (3 user workstations and one network location).
3. Performs clean-up on files older than 3 days, in the targeted locations, to maintain folder space.
I'll be using Visual Studio 2010 to write the C# script.
Because this is an automated script, I certainly won't be writing a Windows Form Application. So, I'm assuming this script will be written as a Console Application project in Visual Studio? Problem is, I've never written a console app that connects to a database. Most of my labs in school were GUI apps, when connecting and working with databases. And I've certainly never written code that dumps or formats anything into an Excel file (I'm only familiar with doing that in Notepad).
What is the easiest way to connect to the database and pull the data through this automated script? Is it difficult to format the data into Excel?
Any and all suggestions would be appreciated. Thank you!