Solved

Create a service to backup a sql database in Visual Studio 2008

Posted on 2013-06-17
2
238 Views
Last Modified: 2013-06-18
Hi Experts

I am new to Visual Studio and would like to create a service that calls a stored procedure that backs up a SQL database that runs in SQL Express.  The service needs to run every morning. I would like call the ADO parameters from a config file.
Can someone point me in the right direction please

Many thanks
Alan
0
Comment
Question by:caandal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 500 total points
ID: 39255577
Hi,

You have two choices, either create a service that will internally check the time in a specified interval, or create a console application that will be called from the Windows Task Scheduler.

Now, as far as the parameters are concerned, you may do the following:
1.Open VS 2008
2.Create a New Project
3.In the Menu go to "Project" and select "YourProjectName Properties"
4.In the opened window go to Settings Tab on the left

You will see a grid with "Name","Type","Scope" and "Value" columns.

"Name" is the name by which you may refer to the specified setting
"Type" is the type of the setting such as integer or string for basic types, or you may even have a specific enumeration
"Scope" from msdn:
Application-scoped settings can be used for information such as a URL for a Web service or a database connection string. These values are associated with the application. Therefore, users cannot change them at run time.

User-scoped settings can be used for information such as persisting the last position of a form or a font preference. Users can change these values at run time.
"Value" is the actual value of the setting.

Now, let's assume that you have a stored procedure that gets the DBName, and the full file name of the backup as arguments.

For this you will need at least three settings in your project:
1.ConnectionString
Name:MyConnString
Type:ConnectionString
Scope:Application
Value: Run the wizard and create the connection string applicable to your scenario

2.DBName
Name:DBName
Type:String
Scope:Application
Value:Your DataBase name you wish to backup

3.Backup Target Path
Name:BackupTarget
Type:String
Scope:Application
Value:The path you wish to save your backup

You may refer to these parameters from your code like:
My.Settings.SettingName

Open in new window


For instance if you would like to get the connection string you would call it as:
My.Settings.MyConnString

Open in new window


For reference in C# you would call it as:
Properties.Settings.Default.MyConnString

Open in new window


That is for starters...Post if you need any more clarification...

Giannis
0
 

Author Closing Comment

by:caandal
ID: 39256108
Hi Giannis

Thanks for that - it does not look too daunting

Cheers
Alan
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question