Exemplo n.º 1
0
 private void toolStripButton4_Click(object sender, EventArgs e)
 {
     if (MysqlHelper.IsConnected())
     {
         MessageBox.Show("连接成功");
     }
     else
     {
         MessageBox.Show("连接失败");
     }
 }
Exemplo n.º 2
0
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            List <string> list   = new List <string>();
            string        result = "";

            list = MysqlHelper.DataReaderTest();
            foreach (string item in list)
            {
                result += item + "\n";
            }
            MessageBox.Show(result);
        }
Exemplo n.º 3
0
        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            DataSet myData = MysqlHelper.DataSetTest();

            foreach (DataTable table in myData.Tables)
            {
                foreach (DataRow row in table.Rows)
                {
                    foreach (object field in row.ItemArray)
                    {
                        MessageBox.Show(field.ToString());
                    }
                }
            }
        }
Exemplo n.º 4
0
        //载入文件菜单
        public void LoadReadHistory()
        {
            IList <string> list     = new List <string>();
            DataSet        filedata = MysqlHelper.SelectData();

            foreach (DataRow row in filedata.Tables[0].Rows)
            {
                list.Add(row["path"].ToString());
            }
            toolStripMenuItem1.DropDownItems.Clear();
            toolStripMenuItem1.DropDownItems.Insert(0, 打开ToolStripMenuItem);
            toolStripMenuItem1.DropDownItems.Insert(1, toolStripSeparator1);
            toolStripMenuItem1.DropDownItems.Insert(2, 退出ToolStripMenuItem);
            toolStripMenuItem1.DropDownItems.Insert(3, 清除ToolStripMenuItem);
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    ToolStripMenuItem menu = new ToolStripMenuItem(list[i]);
                    toolStripMenuItem1.DropDownItems.Insert(i + 1, menu);
                    menu.Click += menu_Click;
                }
            }
        }
Exemplo n.º 5
0
 //退出按钮
 private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MysqlHelper.UpdatePage(filename, page);
     MysqlHelper.MysqlClose();
     Close();
 }
Exemplo n.º 6
0
 //清除按钮
 private void 清除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MysqlHelper.DeleteData();
     LoadReadHistory();
 }
Exemplo n.º 7
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //载入阅读历史
     LoadReadHistory();
     MysqlHelper.MysqlOpen();
 }