Update revision deletes database RRS feed

  • Question

  • I have a fairly large VB project that uses 1 database with 11 tables.  The project works fine with one exception...when I try to update to a new revision it deletes the data. I have tried to set the application files to exclude the new database on the revision but then I receive an error that states that a database already exists.  I've tried excluding the database_log as well and this does not work.  What I would like for it to do is be able to update a users software but allow them to retain the data/database that they have built on their computer.  Extra info:  I am tring to upload the updates to a server, the program connects to the server and determins if there is an update and if so downloads it. The original program is installed by CD(this all works fine).  Thanks in advance!
    Saturday, July 14, 2007 9:26 PM

All replies

  • What I found is happening is that when I update the application it is creating a new database in the App-2.0-Data-... folder and not copying the original database.  It is creating a new folder that is named proc..tion_94e... with the new database the database that holds the users input is in a folder just above this one which is named almost the samething. I've tried changing the "copy always" to "Never" and to "Copy only when newer" and nothing helps.  There must be an easy way to allow the user to keep their data when updating!!!  Thanks.
    Monday, July 16, 2007 2:47 PM
  • After a long search I found a post by Xena Systems that may work however, it is in C# and I don't know that well.  I'm writing in Visual Basic.  Does anyone understand how this would work with visual basic and where it would be placed (maybe on the first form?)  This code should determine if there is another file with the database and copy it into the new one created on publish.


    **** c# I need VB ****

    private string datadirectory




    string datadirectory = "";

    if (ApplicationDeployment.IsNetworkDeployed)

    datadirectory = ApplicationDeployment.CurrentDeployment.DataDirectory;



    FileInfo f = new FileInfo(Assembly.GetExecutingAssembly().Location);

    datadirectory = f.DirectoryName;


    return datadirectory;



    private void MovePre()


    DirectoryInfo dir = new DirectoryInfo(datadirectory + @"\.pre");

    foreach (FileInfo f in dir.GetFiles())


    string newfilename = datadirectory + @"\" + f.Name;

    if (File.Exists(newfilename)) File.Delete(newfilename);

    File.Move(f.FullName, newfilename);




    // in some function or procedure add the following code at start up e.g.

    public void Startup() {

    if (File.Exists(datadirectory + @"\.pre")) MovePre();



    Monday, July 16, 2007 6:27 PM