zoukankan      html  css  js  c++  java
  • c#操作sqlite

    一、添加选中dll引用如下图

    二、下载一个sqlite建表建库工具sqlitedatabasebrowser如下图

    三、使用sqlitedatabasebrowser建库建表

    四、插入表数据如下图

    四、连接sqlite

    public SQLiteConnection GetCon()
            {
        readonly  string DbFile=@"F:project
    et_mk_webzkx_mk_webzkx_mk_webin	ext.db";
        SQLiteConnection SQLCON = new SQLiteConnection("Data Source=" + DbFile + ";Version=3");
                return SQLCON;
            }
    
     public SQLiteConnection open()
            {
                //SQLiteConnection.CreateFile(DbFile);
                SQLiteConnection sqlcon = GetCon();
                if(sqlcon.State!=ConnectionState.Open)
                {
                    sqlcon.Open();
                }
                return sqlcon;
            }

    五、执行sqlite

      public List<String> Execution()
            {
                List<string> data = new List<string>();
                SQLiteConnection opencon = open();
                using (SQLiteCommand sqlcommand = new SQLiteCommand("select * from user", opencon))
                {
                    SQLiteDataReader sqlread = sqlcommand.ExecuteReader();
                    while (sqlread.Read())
                    {
                        data.Add(sqlread["username"].ToString());
                    }
                }
                return data;
            }
  • 相关阅读:
    HTML5新增标签和属性
    HTML——表单标签
    HTML——表格标签
    js
    js
    js
    js
    js-02-2
    js
    selleck --手机端-- 销售打卡记录下载
  • 原文地址:https://www.cnblogs.com/srfree/p/3511097.html
Copyright © 2011-2022 走看看