📄 add.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsApplication2
{
public partial class Add : Form
{
public Add()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Windows.Forms.Application.StartupPath + "/huochaihe.mdb");
myConn.Open();//打开数据库
string article = "insert into article (article_name,article_Comment,article_author) values('" + textBox1.Text + "','" + richTextBox1.Text + "' ,'" + textBox2.Text + "')";
OleDbCommand cmd = new OleDbCommand(article, myConn);//创建Command命令对象
cmd.ExecuteNonQuery();//执行命令
myConn.Close();//关闭数据库
this.Close();
}
private void Add_Load(object sender, EventArgs e)
{
notifyIcon1.Visible = true;
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -