Click here to Skip to main content
Licence CPOL
First Posted 24 Sep 2008
Views 9,102
Downloads 88
Bookmarked 18 times

SqlServer2000 Backup Control

By | 24 Sep 2008 | Article
This control will allow user to backup SqlServer
 
Part of The SQL Zone sponsored by
See Also

Full_Image.jpg

Introduction

This control will allow user to backup SQLServer2000

Background

First time I have problem to make utility for SQLServer2000 Backup.
After reading no of articles i finally made a form for this purpose

But while i started work on my next project i again find problem and i solve it by copy-Paste my existing code and controls to new form.
Then i decided to prepare a user control for this purpose. Now its easy to drag and drop this control on my required form.

Using the code

First make a property for connection string.

Public Property ConnectionString() As String
    Get
        Return _ConnectionString
    End Get
    Set(ByVal value As String)
        _ConnectionString = value
    End Set
End Property        

Write following code on button click event

Try
    Dim conn As New OleDbConnection(_ConnectionString) 
    Dim cm As New OleDbCommand


    cm.CommandText = "backup database master to disk='" & Me.uitxtLocation.Text & "\" & Me.uitxtFileName.Text & ".BAK '"
    cm.Connection = conn
    conn.Open()
    cm.ExecuteNonQuery()
    conn.Close()
    MsgBox("Backup done successfully")


Catch ex As Exception
    MsgBox("An error occured while taking backup: " & ex.Message)
End Try       

History

25-Sep-2008 First upload

25-Sep-2008 Image added

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Rai Shahid

Software Developer
Lumensoft Technologies
Pakistan Pakistan

Member

I 'm Rai Shahid working in Lumensoft Technologies as a Software Engineer. You can visit me on
http://www.softbeats.net
http://blogs.softeats.net

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 24 Sep 2008
Article Copyright 2008 by Rai Shahid
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid