Restoring SQL Database

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 19
Reputation: awo is an unknown quantity at this point 
Solved Threads: 1
awo's Avatar
awo awo is offline Offline
Newbie Poster

Restoring SQL Database

 
0
  #1
Jun 11th, 2009
I am developing an application an am intrested in having to be able to backup and restore the full SQLServer database from the front end. i have succesfully done the the back up module using the code below
Try
                Using dc As New SqlClient.SqlConnection(My.Settings.TRONICALConnectionString)
                    dc.Open()
                    Using dcom As New SqlClient.SqlCommand("BACKUP DATABASE TRONICAL TO DISK = '" & FileName & "'WITH FORMAT,NAME = 'Full Backup of TRONICAL'", dc)
                        dcom.ExecuteNonQuery()
                        'MessageBox.Show("Data base Backup" & dcom.ExecuteNonQuery(), "BACKUP", MessageBoxButtons.OK, MessageBoxIcon.Information)
                        dcom.CommandText = "BACKUP LOG TRONICAL TO DISK = '" & Replace(FileName, ".PrimeBU", ".PrimeBULOG") & "'WITH FORMAT,NAME = 'Full Backup of TRONICAL LOG'"
                        dcom.ExecuteNonQuery()
                        'MessageBox.Show("Database Log  Backup" & dcom.ExecuteNonQuery(), "BACKUP", MessageBoxButtons.OK, MessageBoxIcon.Information)
                        MessageBox.Show("Database Successfully Backup", "BACKUP", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    End Using
                End Using
            Catch ex As Exception
                MessageBox.Show("Backup Error" & Chr(13) & ex.Message, "BACKUP ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
but when i tried using the same model for the restore it give a massage that i do not have exclusive acces to perform the action
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 148
Reputation: samir_ibrahim is on a distinguished road 
Solved Threads: 16
samir_ibrahim's Avatar
samir_ibrahim samir_ibrahim is offline Offline
Junior Poster

Re: Restoring SQL Database

 
0
  #2
Jun 12th, 2009
but when i tried using the same model for the restore it give a massage that i do not have exclusive acces to perform the action
Backup and restore are totally different and they require different parameter to be filled.

So, What do you mean by using the same model for restore?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC