Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    36

    Unanswered: Creating backups and restoring using vb.net

    hey guyz..
    i got this code.. its running... but i am not able to find the file that has been backed up by the program.. pls help.. if there is anything wrong with the codes pls help me

    this code is for creating backups
    Code:
     Dim paramsBackup As String = " -Usa -P -q " & Chr(34) & "Backup database test to disk ='c:\test.bak'" & Chr(34) & " -n "
    
            Try
                Process.Start("c:\program files\microsoft sql server\80\tools\binn\osql.exe", paramsBackup)
                MsgBox("Backuped")
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
    this code is for restoring
    Code:
            Dim paramsRestore As String = " -Usa -P -q " & Chr(34) & "restore database test from disk ='c:\test.bak'" & Chr(34) & " -n "
            Try
                Process.Start("c:\program files\microsoft sql server\80\tools\binn\osql.exe", paramsRestore)
                MsgBox("Restored")
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try

  2. #2
    Join Date
    Dec 2004
    Location
    CA, USA
    Posts
    63
    Does c:\test.bak exist?

    Also, not having password for sa is a big no-no.

  3. #3
    Join Date
    Feb 2005
    Posts
    36
    i am not able to t find it...
    erm its that important?? the password i mean

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    When is the due date for the assignment? Tell your teacher that it's cute to do it, but it's not how it needs to be done. Pat may send you to VDI documentation how to use backup APIs, but I still think it's not the right place to write your backup wrapper. Use T-SQL and life will be much easier and more enjoyable
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Feb 2005
    Posts
    36
    hey...
    T-SQL? can you explain abit about it and what can it do?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •