2012-10-05 4 views
0

guest 계정과 같이 Windows 8에 관리자가 아닌 사용자로 로그인 한 경우이 데이터베이스 작성 코드가 실패합니까? 그렇다면, 내가 변경하는 방법은 관리자가 아닌 사용자와 작동합니다데이터베이스 테이블 만들기 Windows 8 Metro

protected List<Order> orders; 
    string dbName; 
    #region Constructors 

    public RestaurantRepository() 
    { 
     Initialize(); 
    } 

    protected void Initialize() 
    { 

     dbName = "db_sqlite-net.db3"; 

     // check the database, if it doesn't exist, create it 
     CheckAndCreateDatabase(dbName); 
    } 

    #endregion 

    #region Database 

    protected string GetDBPath() 
    { 
     string dbRootPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path; 
     return Path.Combine(dbRootPath, "menufinderwin8.db"); 
    } 

    // This method checks to see if the database exists, and if it doesn't, it creates 
    // it and inserts some data 
    protected void CheckAndCreateDatabase(string dbName) 
    { 
     // create a connection object. if the database doesn't exist, it will create 
     // a blank database 
     SQLiteAsyncConnection conn = new SQLiteAsyncConnection(GetDBPath()); 
     conn.CreateTableAsync<Order>(); 
     conn.CreateTableAsync<Order>(); 
     conn.CreateTableAsync<OrderDetail>(); 
     conn.CreateTableAsync<Product>(); 
     conn.CreateTableAsync<Restaurant>(); 

     //using (SQLiteConnection db = new SQLiteConnection(GetDBPath())) 
     //{ 

      // create the tables 
      // db.CreateTable<Order>(); 
      //db.CreateTable<OrderDetail>(); 
      //db.CreateTable<Product>(); 
      //db.CreateTable<Restaurant>(); 
      // close the connection 
      //db.Close(); 
     //} 

    } 

답변

0

내가 한 앱이 모든 사용자를 위해, 그것은 자신의 로컬 디렉토리에 액세스 할 수 있어야합니다 설치되어 생각합니다. 나는 당신이 사용자들간에 데이터베이스를 공유 할 수있을 것이라고 생각하지 않지만 실패 할 것이라고 생각하지는 않습니다.

궁금한 점이 있으면 알려주세요.

+0

맞습니다. 권한은 중요하지 않습니다. –

관련 문제