943,832 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 609
  • VB.NET RSS
Jun 11th, 2009
0

Restoring SQL Database

Expand Post »
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
Similar Threads
awo
Reputation Points: 10
Solved Threads: 1
Newbie Poster
awo is offline Offline
21 posts
since Oct 2007
Jun 12th, 2009
0

Re: Restoring SQL Database

Quote ...
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?
Reputation Points: 69
Solved Threads: 19
Junior Poster
samir_ibrahim is offline Offline
155 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Array in VB.net
Next Thread in VB.NET Forum Timeline: Grouping DataGridView Column Results





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC