Esempio n. 1
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var memberLogin = new MemberLogin
                {
                    email    = this.Email.Text,
                    password = this.Password.Password
                };

                var memberCredential = this._memberService.Login(memberLogin);
                ProjectAPI.CurrentMemberCredential = memberCredential;
                this._fileService.SaveMemberCredentialToFile(memberCredential);
                this.Frame.Navigate(typeof(AllMusic));

                // tao bang trong SQLite
                SQLiteDemo sQLiteDemo = new SQLiteDemo();
                sQLiteDemo.LoadDatabase();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }
Esempio n. 2
0
 public SQLiteDemo(SQLiteDemo model)
     : base(model)
 {
 }
Esempio n. 3
0
    void Start()
    {
        thisSQLiteDemo = this;

        CreateDatabase();
        CreateTable();

        //FindField("SerialNumber");
        //FindField("Name");
        //FindField("Gender");
        //FindField("Age");
        //for (int i = 0; i < AllFields.Length; i++)
        //{
        //    FindField(AllFields[i]);
        //}

        //InsertData(new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9" });
        ////InsertData(new string[] { "2", "2", "3", "4", "5", "6", "7", "8", "9" });
        ////InsertData(new string[] { "3", "2", "3", "4", "5", "6", "7", "8", "9" });
        //InsertData(new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9" });
        //QueryData("1");
        ////更新数据,将Name="张三"的记录中的Name改为"Zhang3"
        //sql.UpdateValues("table1", new string[] { "Name" }, new string[] { "'Zhang3'" }, "Name", "=", "'张三'");

        ////插入3条数据
        //sql.InsertValues("table1", new string[] { "3", "'王五'", "25", "'*****@*****.**'" });
        //sql.InsertValues("table1", new string[] { "4", "'王五'", "26", "'*****@*****.**'" });
        //sql.InsertValues("table1", new string[] { "5", "'王五'", "27", "'*****@*****.**'" });

        //删除Name="王五"且Age=26的记录,DeleteValuesOR方法类似
        //sql.DeleteValuesAND("table1", new string[] { "Name", "Age" }, new string[] { "=", "=" }, new string[] { "'王五'", "'26'" });

        //读取整张表

        //SqliteDataReader reader = sql.ReadFullTable("table1");
        //while (reader.Read())
        //{
        //    //读取ID
        //    Debug.Log(reader.GetInt32(reader.GetOrdinal("ID")));
        //    //读取Name
        //    Debug.Log(reader.GetString(reader.GetOrdinal("Name")));
        //    //读取Age
        //    Debug.Log(reader.GetInt32(reader.GetOrdinal("Age")));
        //    //读取Email
        //    Debug.Log(reader.GetString(reader.GetOrdinal("Email")));
        //}

        ////读取数据表中Age>=25的所有记录的ID和Name
        //reader = sql.ReadTable(TalbleName, new string[] { "ID", "Name" }, new string[] { "Age" }, new string[] { ">=" }, new string[] { "'25'" });
        //while (reader.Read())
        //{
        //    //读取ID
        //    Debug.Log(reader.GetInt32(reader.GetOrdinal("ID")));
        //    //读取Name
        //    Debug.Log(reader.GetString(reader.GetOrdinal("Name")));
        //}

        ////自定义SQL,删除数据表中所有Name="王五"的记录
        //sql.ExecuteQuery("DELETE FROM table1 WHERE NAME='王五'");

        ////关闭数据库连接
        //sql.CloseConnection();
    }