Example #1
0
        /// <summary>
        /// 根据user创建数据库,把昵称传给mainwindow
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            int user = Convert.ToInt32(textBox1.Text);

            MySQLConn.CreateDB(textBox3.Text);                        //根据昵称创建数据库
            MySQLConn.InsertUser(user, textBox2.Text, textBox3.Text); //保存用户名和密码到数据库
            MySQLConn.CreateTable(textBox3.Text, "love");
            MySQLConn.CreateTable(textBox3.Text, "history");
            MySQLConn.CreateTable(textBox3.Text, "songlist");
        }
Example #2
0
        /// <summary>
        /// 添加歌单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddList_Click(object sender, EventArgs e)
        {
            string     name   = null;
            NameDialog Dialog = new NameDialog("new_songlist");

            if (Dialog.ShowDialog() == DialogResult.OK) //弹出命名对话框
            {
                name = Dialog.Result;                   //获得新名字
            }
            //添加新歌单控件
            MenuList.Add(new Item(Resources.list, name));
            SongsList.Items.Add(name);
            //添加新歌单
            SongList songList = new SongList(name);

            SongLists.Add(songList);
            MySQLConn.CreateTable(label1.Text, name);//数据库创建一个表
        }