VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Backup And Shrink Your Database In Visual Basic, Work 100%

by Buddhika Fernando (9 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 30th December 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Backup And Shrink Your Database In Visual Basic, Work 100%

Rate Backup And Shrink Your Database In Visual Basic, Work 100%



    
    ' Use Microsoft SQL DMO Object Library
    ' Using SQLDMO U Can Get More Features.
    ' If You Want To Get More Mail Me
    ' [email protected]
    ' [email protected]
    Dim SVR         As New SQLDMO.SQLServer

On Error GoTo error_h
    MsgBox "Upur Database Going To Shrink And Backup Now"
    Screen.MousePointer = vbHourglass
    SVR.Connect "RANGANA\RANGANA", "sa", "abc"
    
    Dim Temp
    
    Temp = ""
    Temp = " ---- Write SQL Backup Script"
    
    SVR.Databases("invacc_Duallink").Shrink 0, SQLDMOShrink_Default
    SVR.ExecuteImmediate Temp, SQLDMOExec_Default Or SQLDMOExec_ContinueOnError
    
    MsgBox "Completed"
    Screen.MousePointer = vbDefault
    SVR.DisConnect
    Set SVR = Nothing

error_h:
    If Err Then
        MsgBox Err.Description
        SVR.DisConnect
        Set SVR = Nothing
    End If
    
End Sub


Download this snippet    Add to My Saved Code

Backup And Shrink Your Database In Visual Basic, Work 100% Comments

No comments have been posted about Backup And Shrink Your Database In Visual Basic, Work 100%. Why not be the first to post a comment about Backup And Shrink Your Database In Visual Basic, Work 100%.

Post your comment

Subject:
Message:
0/1000 characters