private static string _startPath = string.Empty; /// <summary> /// 获取应用程序启动的路径 /// </summary> public static string StartPath { get { if (string.IsNullOrEmpty(_startPath)) { _startPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); } return _startPath; } }

在这里,还有一点需要注意,我们再操作SQLite数据库的时候,如果程序没有找到SQLite数据库的时候,程序不会报“连接数据库失败”,他会在对应的文件夹下面自动创建一个数据库文件,当我们进一步去访问表的时候,就会报类似于“没有找到表”的错误,所以,在编程过程中,如果遇到“没有找到表”的错误,就应该去检查一下,路径下面是否有SQLite数据库文件。

相关下载:SQLite.rar

相关文章:

  • 2022-03-06
  • 2022-03-02
  • 2021-09-14
  • 2022-12-23
  • 2021-10-19
  • 2021-06-13
  • 2021-12-20
猜你喜欢
  • 2022-02-20
  • 2021-11-17
  • 2021-12-01
  • 2021-11-08
  • 2021-06-16
相关资源
相似解决方案