WinCE中使用本地数据库SQLite以及得到当前应用程序所在路径

时间:2014-03-20 18:10:07   收藏:0   阅读:454

这两天在写底层的SqlHelper,操作了本地数据库SQLite和WebService,下面记录一下怎样获取应用程序所在路径及SQLite连接字符串配置。

bubuko.com,布布扣
        private const string dbName = @"\Data.db";


        public static string GetFileAddr()
        {
            string retaddra = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            return retaddra;
        }

        public static SQLiteConnection GetConn()
        {
            string path = @"Data Source=" + GetFileAddr() + dbName +@";Version=3;New=false;Compress=True;";
            SQLiteConnection conn = new SQLiteConnection(path);
            return conn;
        }    
bubuko.com,布布扣

使用SQLite时需导入System.Data.SQLite.dll,SQLite.Interop.060.dll动态链接库并在代码中引用“using System.Data.SQLite;”

WinCE中使用本地数据库SQLite以及得到当前应用程序所在路径,布布扣,bubuko.com

原文:http://www.cnblogs.com/Leawee/p/3612971.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!