找传奇、传世资源到传世资源站!

源码:打造属于自己的英语词典(sqlite数据库)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

         1、C#操作sqlite本地数据库;         2、可以录入自己喜欢的英语单词,打造出属于自己的英语词典。主要是C#对本地数据库sqlite的操作演练from clipboard
using CC.BLL;using CC.Helper;using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace translate{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } /// <summary> /// 录入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { save(); } private void save() { try { if (!h_encrypt.HasHanz(textBox1.Text)) { new b_en_ch().save(textBox1.Text, textBox2.Text, textBox3.Text); MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { h_mylog.WriteLog(ex, "Form1.cs", "button2_Click"); } } /// <summary> /// 查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { search(); } private void search() { try { clear(); DataTable dt = null; if (h_encrypt.HasHanz(textBox1.Text)) { dt = new b_en_ch().get_by_ch(textBox1.Text); if (dt != null && dt.Rows.Count == 1) { textBox2.Text = dt.Rows[0]["read"].ToString(); textBox3.Text = dt.Rows[0]["english"].ToString(); } } else { dt = new b_en_ch().get_by_en(textBox1.Text); if (dt != null && dt.Rows.Count == 1) { textBox2.Text = dt.Rows[0]["read"].ToString(); textBox3.Text = dt.Rows[0]["chinese"].ToString(); } } } catch (Exception ex) { h_mylog.WriteLog(ex, "Form1.cs", "search"); } finally { } } private void clear() { textBox2.Text = ""; textBox3.Text = ""; } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { search(); } } private void textBox3_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.S) { save(); } } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复