following is the code for taking back-up of data in vb6.0( and MS-Access)
i want to conver it into vb.net2003 (and SQL server 2000)
its very urgent
i want to implement it into my project
Private Sub mnuRestore_Click()
On Error GoTo errdes
C1.CancelError = True
MsgBox "If You want to Restore Your Data" & vbCrLf & " Insert Floppy Disk", vbInformation
Dim FSys As New FileSystemObject
Dim thisFile As File
msg = MsgBox("Your Records will be Updated Permanently " & vbCrLf & _
" Are You Sure............................?", vbInformation + vbYesNo, "Restore")
If msg = vbNo Then Exit Sub
C1.InitDir = "A:"
C1.Filter = "Backup|*.mdb"
C1.DialogTitle = "Restore Data"
C1.ShowOpen
Set thisFile = FSys.GetFile(C1.FileName)
'thisFile.Copy App.Path & "\adv.mdb", True
thisFile.Copy "C:\sagar.mdb", True
'Timer1.Enabled = True
Exit Sub
errdes:
If Err.Number = 32755 Then
Exit Sub
Else
MsgBox Err.Description, vbInformation, "Error"
End If
End Sub
Private Sub mnuBackUp_Click()
On Error GoTo errdes
'If glb_Decl.id <> "Administrator" Then
'MsgBox "Plz Contact Your Administrator", vbInformation, "Warning@OHMS Air Con"
'Exit Sub
'End If
C1.CancelError = True
MsgBox "If You want to take BackUp on Floppy Disk" & vbCrLf & " Insert Floppy Disk", vbInformation
Dim FSys As New FileSystemObject
Dim thisFile As File
Dim fld As Folder
Set thisFile = FSys.GetFile(App.Path & "\sagar.mdb")
msg = MsgBox("Want To Need BackUp of Your Data", vbYesNo + vbQuestion)
If msg = vbNo Then Exit Sub
C1.InitDir = "A:"
C1.Filter = "Backup|*.mdb"
C1.FileName = "BackUpShriGanesh"
C1.DialogTitle = "ShriGanesh's Backup"
C1.ShowSave
'************************************************************************
Dim d As Integer
Dim ln As Integer
Dim sd As String
Dim filenm As String
d = InStrRev(C1.FileName, "\") 'Checking Parent For Create Folder and Return Position last "\"
sd = Mid(C1.FileName, 1, d) 'Return Path for Creating Folder
Set fld = FSys.CreateFolder(sd & "ShriGaneshBackup") 'Creating Folder
ln = Len(C1.FileName) 'Return Length of Full Path
chk = ln - d 'Return Only File Name Length
filenm = Right(C1.FileName, chk) 'Return File Name
'*************************************************************************
thisFile.Copy fld.Path & "\" & filenm
Exit Sub
errdes:
If Err.Number = 32755 Then
Exit Sub
Else
MsgBox Err.Description, vbInformation, "Error"
End If
End Sub