当前位置:首页 > 数据库 > SQlite

关于C#中“配置”sqlite问题

去除这个警告,只要在解决方案,右击,属性,生成,把anycpu改为X86,即OK!

第二个问题是运行sqlite语句,如连接

using (SQLiteConnection con = new SQLiteConnection(ConnStr))
{
con.Open();
using (SQLiteCommand com = new SQLiteCommand())
{
com.Connection = con;
com.CommandText = "insert into T_Login values(‘2015‘,‘2015‘)";
com.ExecuteNonQuery();
}
}

则会出现:“System.IO.FileLoadException”类型的未经处理的异常在 PresentationCore.dll

解决方法:

Paste the following XML inside the configuration tag:

  <startup useLegacyV2RuntimeActivationPolicy="true">     <supportedRuntime version="v4.0"/>   </startup>

其实只要往原有的<startup>标签中加入useLegacyV2RuntimeActivationPolicy="true" 即OK。

 

sqlite连接语句:最简单的,直接给个路径 string ConnStr = @"Data Source=C:\zhj.db";

在configuration tag 中:

<connectionStrings>
<add name="dbConnStr" connectionString="Data Source=C:\zhj.db;Pooling=true;FailIfMissing=false"/>
</connectionStrings>

关于C#中“配置”sqlite问题

标签:

本文系统来源:http://www.cnblogs.com/joeymary/p/4656774.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!