2 Replies - 594 Views - Last Post: 29 October 2013 - 04:35 PM Rate Topic: -----

#1 Quizton  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 49
  • Joined: 18-April 12

Upload sqlite db to skydrive / download and replace storage w backup

Posted 28 October 2013 - 08:38 AM

I upload my SQLite db to skydrive using

        private async void BackupDB_Click(object sender, RoutedEventArgs e)
        {
            string folderID = "me/skydrive";
            var fileName = await ApplicationData.Current.LocalFolder.GetFileAsync("Mysqlitewinrt.db");
            if (string.IsNullOrEmpty(fileName.ToString()) || string.IsNullOrEmpty(folderID))
            {
                return;
            }
            else
            {
                var liveConnectClient = session;
                if (signedIn == false)
                { MessageBox.Show("You Must Be Signed In To Backup Data to SkyDrive"); return; }
                try
                {
                    client = new LiveConnectClient(session);
                    MessageBox.Show("Backing up your Data ");
                    var res = await client.BackgroundUploadAsync(folderID, new Uri("/shared/transfers/" 
                    + fileName,UriKind.Relative), OverwriteOption.Overwrite);

                }
                catch (LiveConnectException exception)
                {

                    statusTextBlock.Text = exception.Message;
                }
            }
        }



the result is a windowsstorage.storagefile sitting nicely in skydrive.

to download
            private async void LoadDB_Click(object sender, RoutedEventArgs e)
            {
            string folderID = "me/skydrive";
            StorageFile fileName = await ApplicationData.Current.LocalFolder.GetFileAsync("Mysqlitewinrt.db");
            if (string.IsNullOrEmpty(fileName.ToString()) || string.IsNullOrEmpty(folderID))
            {
                return;
            }
            else
            {
               
                var liveConnectClient = session;
                if (signedIn == false)
                { MessageBox.Show("You Must Be Signed In To Load Data from SkyDrive"); return; }
                try
                {
                    client = new LiveConnectClient(session);
                    MessageBox.Show("Loading Data ");
                    var res = client.BackgroundDownloadAsync(folderID +"/content", new Uri("/shared/transfers/"
                    + fileName, UriKind.Relative));
  var appStorage = IsolatedStorageFile.GetUserStoreForApplication();
                    
                   
                    using (StreamReader sr = new StreamReader(appStorage.OpenFile
                   (res  + "/content",FileMode.OpenOrCreate, FileAccess.ReadWrite)))
                { 
                    infoTextBox.Text = sr.ReadToEnd(); }
                }
                catch (LiveConnectException exception)
                {

                    statusTextBlock.Text = exception.Message;
                }
            }
        }      



It seems to be null as I don't see anything retrieving, what I would like to happen is replace the SQLite.db file in isolated storage with the backup. I have tried lots of different ways and have had no luck. any help would be much appreciated ;)/>/>

This post has been edited by Quizton: 28 October 2013 - 08:40 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Upload sqlite db to skydrive / download and replace storage w backup

#2 Quizton  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 49
  • Joined: 18-April 12

Re: Upload sqlite db to skydrive / download and replace storage w backup

Posted 28 October 2013 - 01:06 PM

I was wrong it is returning a Microsoft live operation result folder in isolated storage .
Id like it to replace the db folder as a whole with the data from sqlitedb
Was This Post Helpful? 0
  • +
  • -

#3 Quizton  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 49
  • Joined: 18-April 12

Re: Upload sqlite db to skydrive / download and replace storage w backup

Posted 29 October 2013 - 04:35 PM

private async void LoadDB_Click(object sender, RoutedEventArgs e)
          {
          string folderID = "me/skydrive";
          StorageFile fileName = await ApplicationData.Current.LocalFolder.GetFileAsync("Mysqlitewinrt.db");
          if (string.IsNullOrEmpty(fileName.ToString()) || string.IsNullOrEmpty(folderID))
          {
              return;
          }
          else
          {
             
              var liveConnectClient = session;
              if (signedIn == false)
              { MessageBox.Show("You Must Be Signed In To Load Data from SkyDrive"); return; }
              try
              {
                  client = new LiveConnectClient(session);
                  MessageBox.Show("Loading Data ");
                  var res = client.BackgroundDownloadAsync(folderID +"/content", new Uri ("/shared/transfers/"
                  + fileName, UriKind.Relative));
var appStorage = IsolatedStorageFile.GetUserStoreForApplication();
                  
                 
                         }
      }      


removed streamreader stuff for clarity .. still having trouble with this any help would be great
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1