Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    Mumbai, India
    Posts
    15

    Question Unanswered: database restore in vb

    Hi,

    I am currently working on a proj as a college assignment and am creating an adinistrative system for a school.

    I have vb as frontend and sql as my backend

    My problem is that I have to create a backup and restoration of the database at runtime from vb...database in sql.

    I have used this statement in vb....(conn is the connection)

    conn.execute(BACKUP DATABASE aphs TO DISK = 'c:\aphs_test.bak')

    this is working fine and I get a .bak file created.
    the problem is how do I restore that database. I tried using

    RESTORE DATABASE aphs FROM DISK 'c:\aphs_test.bak'

    though this query works in sql it doesn't seem to be working when I put it in my vb proj.

    I am aware that I create a backup, restore in sql itself...but I wanted to do the same at runtime in vb.This would of great help...thanxs.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: database restore in vb

    I think maybe you are encountering a permissions issue? Make sure your connection string has the write permission level to execute that statement (username, password, or Integrated Security). Otherwise it should work as you coded.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Mar 2004
    Location
    Mumbai, India
    Posts
    15

    setting permission to db

    thanx. U may be write..but is it possible that it is becos I haven't closed all the connections in my vb proj...though I believe that I have done so.
    Also, I wanted to know how to set permission on my sql database.
    I know its done through enterprise manager but don't know the procedure can u help me out with that. -- thankyou very much. - vijay.

  4. #4
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: setting permission to db

    My pleasure, through entrprise manager under each database there is a Users section, in the users section you have all the users assigned to that database, if you right-click and select properties you will be easily be able to modify the user permissions.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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