Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm currently working on a program, but the backup part prompt me this error massage:
VB
Private Sub FullBackUp()
        Try
            sqlCmd = New SqlCommand()
            sqlCmd.Connection = sqlCon
            sqlCmd.CommandType = CommandType.StoredProcedure
            sqlCmd.CommandText = "prcBackUpFullData"
            'Add Tenant Details
            sqlCmd.Parameters.AddWithValue("@DatabaseName", "CLINIC")
            sqlCmd.Parameters.AddWithValue("@path", filePath)
            'open sqlcon
            sqlCon.Open()
            'Perfoming the full back up
            Me.LabMsg.Text = "Wait while System is performing the full CLINIC back up......"
            _result = sqlCmd.ExecuteNonQuery()
            If _result = -1 Then
                Me.LabMsg.Text = "The STOCK Full back up performed successfully."
                MessageBox.Show("The STOCK database has been back up successfully. ", "Back Up ", MessageBoxButtons.OK, MessageBoxIcon.Information)
                btnBrowse.Enabled = True
                Me.LabMsg.Text = "Done."
            End If
        Catch ex As Exception
            Me.LabMsg.Text = "Unable to perform the STOCK back up."
            MessageBox.Show(ex.Message.ToString, "Back up", MessageBoxButtons.OK, MessageBoxIcon.Error)
            MessageBox.Show("Unable to perform the STOCK back up. Close the form and try it again." + vbCrLf + "If the problem persists, please contact the vendor.", "Back up ", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Finally
            sqlCon.Close()
            sqlCmd = Nothing
        End Try
    End Sub

this is the error message
Cannot open detabase divice.....Operating system error 5(Access is denied.). BACKUP DATABASE is terminating abnormally.
Posted
Updated 4-Oct-10 6:21am
v2

1 solution

Check if you have access to the actual database.

Also, check this[^] thread.
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900