安然不哭-西坝阿超个人博客

做技术一定要一颗恒心,这样才不会半途而废。

c# sql帮助类

2018-5-6 钟建超

sqlite

public class SqliteHelp
    {
        string path = "Data Source =" + System.Windows.Forms.Application.StartupPath + "/all.db;Pooling=true;FailIfMissing=false";
        public DataTable select(SQLiteCommand comm)
        {
            using (SQLiteConnection conn=new SQLiteConnection(path))
            {
                conn.Open();
                comm.Connection = conn;
                SQLiteDataAdapter adpter = new SQLiteDataAdapter(comm);
                DataTable dt = new DataTable();
                adpter.Fill(dt);
                return dt;
            }
        }
        public int update(SQLiteCommand comm)
        {
            using (SQLiteConnection conn=new SQLiteConnection(path))
            {
                conn.Open();
                comm.Connection = conn;
                return comm.ExecuteNonQuery();
            }
        }
    }

获取路径请参考

http://blog.achao.cc/16.html










标签: c#