基本信息
源码名称:源码:打造属于自己的英语词典(sqlite数据库)
源码大小:1.77M
文件格式:.zip
开发语言:C#
更新时间:2019-11-05
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 1 元 
   源码介绍

         1、C#操作sqlite本地数据库;

         2、可以录入自己喜欢的英语单词,打造出属于自己的英语词典。

主要是C#对本地数据库sqlite的操作演练


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();
            }
        }
    }
}