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


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

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

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

  • 相关阅读:
    excelhelp
    导入数据到GridView
    sql2005悠改sa
    状态存储管理 encode,decode,transfer
    Session持久化
    Microsoft SQL Server 2005 数据类型
    Cookie (HttpCookie的实例)
    role设计
    ajax
    poj 3370 Halloween treats 夜
  • 原文地址:https://www.cnblogs.com/Leawee/p/3612971.html
Copyright © 2020-2023  润新知