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

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?

This article has been dead for over six months. Start a new discussion instead.