public void Save(string a, string b) { SqlNote sql = new SqlNote(); DateTime r = DateTime.Now.ToLocalTime(); string d = "insert into Note values ('" + a + "','" + b + "','" + r + "')"; if (sql.ExecuteSQL(d)) { MessageBox.Show("同步上传到数据库成功!!!"); } }
public void Register(string a, string b) { SqlNote sql = new SqlNote(); string c = "select count(*) from Login where Login_Name = '" + a + "'"; if (sql.GetCount(c) > 0) { MessageBox.Show("用户名重复!!!"); } else { string d = "insert into Login values ('" + a + "','" + b + "')"; if (sql.ExecuteSQL(d)) { MessageBox.Show("注册成功"); } } }
private void button2_Click(object sender, EventArgs e) { SqlNote sql = new SqlNote(); SqlConnection cn = new SqlConnection("Data Source=OPPAI;Initial Catalog=NoteBook;Integrated Security=True"); SqlCommand com = new SqlCommand("select Note_PathName from Note where Note_Notes = '" + a + "'", cn); cn.Open(); string g = com.ExecuteScalar().ToString(); cn.Close(); string c = "delete from Note where Note_PathName = '" + g + "'"; if (sql.ExecuteSQL(c)) { string f = "select * from Note"; dataGridView1.DataSource = sql.GetDataTable(f); } }