Results 1 to 5 of 5

Thread: restore a data base

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    19

    Exclamation restore a data base

    hi
    i have created the back up of my database in sql server 2000 but i can restore it.
    my teacher gave me the code but it gives the error user defined type not defined
    the code is in the attachment can u plz tell me whts wrong with this
    i have also added the dll file for sql as instructed by my teacher
    Attached Files Attached Files

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: restore a data base

    You won't need such a big class module for this. I did this long ago, so I'm not sure whether these statements would work correctly or you may need some minor modifications to the SQL statement:
    VB Code:
    1. Dim conn As New ADODB.Connection
    2. conn.open "PROVIDER=MSDASQL;Driver=SQL Server;Server=YourServerName;Database=master;UID=sa;PWD=Yourpassword;"
    3. conn.Execute "use master;Restore Database YourDBName from YourDBBackupFile;"
    4. conn.Close
    5. set conn = Nothing

    Hope this helps

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: restore a data base

    You need to add a reference to the Microsoft SQLDMO Object Library to your project.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    19

    Exclamation Re: restore a data base

    Quote Originally Posted by brucevde
    You need to add a reference to the Microsoft SQLDMO Object Library to your project.
    thanx for ur reply but i have added a .dll file into my project folder
    how can i add a reference

  5. #5

Posting Permissions

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



Click Here to Expand Forum to Full Width