Tag: sqlite

你如何使用LINQ与Sqlite

有人会解释如何让LINQ使用Sqlite。

在可移植类库中使用SQLite

最近我们开始研究一个新项目,其中包括Windows 8 Metro,Windows Phone和桌面应用程序的客户端。 决定使用MVVM模式作为主要架构,因为在项目之间共享ViewModel对我们来说是更可接受的解决方案。 我们决定为此目的使用可移植类库,但问题是在我们尝试添加对适当库的引用后,从Visualstudio 2012扩展库下载并安装SQLite for Windows运行时,我们根本看不到这些库。 这让我们想到,在Portable类库项目中不可能使用SQLite。 也许你已经完成了一些并知道我们实现这种function的方式? 请提供正确的方法来开发此任务,因为使用SQLite并且在开发的这个阶段具有可重用的代码非常重要

如果它不存在,以编程方式创建sqlite db?

我试图以编程方式创建一个sqlite db,如果它不存在。 我写了下面的代码但是我在最后一行得到了一个例外。 if (!System.IO.File.Exists(“C:\\Users\\abc\\Desktop\\1\\synccc.sqlite”)) { Console.WriteLine(“Just entered to create Sync DB”); SQLiteConnection.CreateFile(“C:\\Users\\abc\\Desktop\\1\\synccc.sqlite”); string sql = “create table highscores (name varchar(20), score int)”; SQLiteCommand command = new SQLiteCommand(sql, sqlite2); command.ExecuteNonQuery(); } sqlite2 = new SQLiteConnection(“Data Source=C:\\Users\\abc\\Desktop\\1\\synccc.sqlite”); 我在行command.ExecuteNonQuery();得到了exceptioncommand.ExecuteNonQuery(); 例外是Invalid operation exception was unhandled 。 有没有其他方法可以将sqlite文件添加到您的项目中? 我可以手动完成吗? 如果没有,那么我该如何解决上述问题呢?

以编程方式访问Google Chrome历史记录

我想索引谷歌浏览器中的所有用户操作和网站。 据我所知,谷歌chrome索引sqlLite数据库中的所有数据。 我如何以编程方式访问我自己的应用程序中的chrome Web历史记录

SQLite更新后:无法在DLL“SQLite.Interop.dll”中找到名为“sqlite3_changes_interop”的入口点

我的C#/ SQLite工作正常,直到我决定更新SQLite DLL(从1.0.82.0到1.0.84.0)。 现在我遇到了这个崩溃: 无法在DLL“SQLite.Interop.dll”中找到名为“sqlite3_changes_interop”的入口点 A first chance exception of type ‘System.EntryPointNotFoundException’ occurred in System.Data.SQLite.dll System.Transactions Critical: 0 : http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/UnhandledUnhandled exceptionSparkleShare.vshost.exeSystem.EntryPointNotFoundException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Unable to find an entry point named ‘sqlite3_changes_interop’ in DLL ‘SQLite.Interop.dll’. at System.Data.SQLite.UnsafeNativeMethods.sqlite3_changes_interop(IntPtr db) at System.Data.SQLite.SQLite3.get_Changes() at System.Data.SQLite.SQLiteStatement.TryGetChanges(Int32& changes) at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() […]

如何将CSV文件批量插入SQLite C#

我见过类似的问题( 1,2 ),但没有一个讨论如何将CSV文件插入SQLite。 关于我唯一能想到的就是使用CSVDataAdapter并填充SQLiteDataSet ,然后使用SQLiteDataSet更新数据库中的表: 我发现的唯一的CSV文件DataAdapter实际上并不可用: CSVDataAdapter CSVda = new CSVDataAdapter(@”c:\MyFile.csv”); CSVda.HasHeaderRow = true; DataSet ds = new DataSet(); // <– Use an SQLiteDataSet instead CSVda.Fill(ds); 要写入CSV文件: CSVDataAdapter CSVda = new CSVDataAdapter(@”c:\MyFile.csv”); bool InclHeader = true; CSVda.Update(MyDataSet,”MyTable”,InclHeader); 我找到了上面的代码@ http://devintelligence.com/2005/02/dataadapter-for-csv-files/ CSVDataAdapter应该配备OpenNetCF的SDF ,但它似乎不再可用了。 有谁知道我可以在哪里获得CSVDataAdapter ? 也许有人知道更简单的事情:如何将CSV文件批量插入到SQLite中……非常感谢您的帮助!

自定义函数SQLite与Mono

有没有办法使用Mono添加SQLite自定义函数? (Mono.Data.Sqlite) 我尝试添加距离函数,返回两个地理位置之间的距离 [SqliteFunctionAttribute(Name = “distance”, Arguments = 4, FuncType = FunctionType.Scalar)] class SqliteDistance : SqliteFunction { public override object Invoke(object[] args) { double radius = 6367; double lat1 = System.Convert.ToDouble(args[0]); double lng1 = System.Convert.ToDouble(args[1]); double lat2 = System.Convert.ToDouble(args[2]); double lng2 = System.Convert.ToDouble(args[3]); return radius * 2 * Math.Asin( Math.Min(1, Math.Sqrt( ( Math.Pow(Math.Sin((lat2* (Math.PI / […]

带有Entity Framework的SQLite DATETIME列

我有一个现有的SQLite数据库,我想在Entity Framework中使用它。 然而,SQLite奇怪的类型系统意味着你甚至可以 create table temp(temp datetime); insert into temp values (‘whatever’); 日期存储为Unix时间整数。 我的模型类是由Visual Studio自动生成的,那么如何告诉代码生成器正确处理这些日期而不是让应用程序抛出 字符串未被识别为有效的DateTime。 启动时的exception?

如何在WAL模式下打开SQLite连接

在C#中,如何在WAL模式下打开SQLite连接? 以下是我在正常模式下打开的方式: SQLiteConnection connection = new SQLiteConnection(“Data Source=” + file); connection.Open(); // (Perform my query)

通过C#检查计算机上是否安装了SQL Server

我正在创建一个应用程序,它是一个用户界面,可以访问两种类型的数据库 – SQLite和SQL Server。 问题是,SQLite不需要“安装”,因为它只是一个flatfile数据库,但另一方面,SQL Server(Express / normal)需要在使用前安装。 我的问题很简单: 有没有办法通过使用C#程序找出本地机器上是否安装了SQL Server实例?