由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C# 和 SQLite 连接问题,多谢拉
相关主题
A string replacement problem from leetcodeJava10年前的崛起是技术到达一定成熟度的标志
VS2012太垃圾了VS2012 C# programing questions for record antomation test
我老版问我要做一个ribbon for WPF project, 从哪开始呀? (转载)
想自己搞一light weight in memory数据库in C#,求教大家c++开发GUI用什么工具?
fossil 不错看了一下C#的async await
问一个简单的binary tree 问题C++ 11问题:emplace_back()
请问大家一个eclipse CDT的问题 (转载)想学ios html game development, 请推荐入门的package/tool
FYI, vs2012 supports XP server 2003 nowWindows下如何设置自己的DNS?
相关话题的讨论汇总
话题: using话题: sqlitecon话题: text话题: vs2012
进入Programming版参与讨论
1 (共1页)
D**u
发帖数: 288
1
本人.net菜鸟,因为暂时用不了SQL Server,想把一些数据存在SQLITE里。在
Stackoverflow
上看到大家推荐 System.Data.SQLite,
觉得很不错,不过在VS2010 Professional和VS2012 Express 和VS2012 Ultimate上都
没有试成功,恳请指点。
我的code是参考这个网站上的
http://www.techcoil.com/blog/my-experience-with-system-data-sql
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SQLite;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string dbConnectionString = @"Data Source=sample.s3db";
SQLiteConnection sqliteCon = new SQLiteConnection(
dbConnectionString);
sqliteCon.Open();
string createAppUserTableSQL = "CREATE TABLE [AppUser] (" +
"[name] TEXT NULL," +
"[username] TEXT NULL" +
")";
using (SQLiteTransaction sqlTransaction = sqliteCon.
BeginTransaction())
{
SQLiteCommand createCommand = new SQLiteCommand(
createAppUserTableSQL, sqliteCon);
createCommand.ExecuteNonQuery();
createCommand.Dispose();
sqlTransaction.Commit();
}
sqliteCon.Close();
}
}
}
错误是:
Could not load file or assembly 'System.Data.SQLite, Version=1.0.84.0,
Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies
. An attempt was made to load a program with an incorrect format.
在下多谢了!!!
c*********e
发帖数: 16335
2
首先,你要在reference里把System.Data.SQLite加进去,光
using System.Data.SQLite是不够的。

【在 D**u 的大作中提到】
: 本人.net菜鸟,因为暂时用不了SQL Server,想把一些数据存在SQLITE里。在
: Stackoverflow
: 上看到大家推荐 System.Data.SQLite,
: 觉得很不错,不过在VS2010 Professional和VS2012 Express 和VS2012 Ultimate上都
: 没有试成功,恳请指点。
: 我的code是参考这个网站上的
: http://www.techcoil.com/blog/my-experience-with-system-data-sql
: using System;
: using System.Collections.Generic;
: using System.Linq;

D**u
发帖数: 288
3
恩,加了的,code里面都没有下划线
D**u
发帖数: 288
4
补充点信息,现在的是刚下在的VS Ultimate 2012 30 天trial version, .net4.5。所
以安装了
Precompiled Binaries for 64-bit Windows (.NET Framework 4.5)
sqlite-netFx45-binary-bundle-x64-2012-1.0.84.0.zip
c*********e
发帖数: 16335
5
你下载的System.Data.SQLite是哪个版本:1.0.66.0 version,or 1.0.84.0?

【在 D**u 的大作中提到】
: 恩,加了的,code里面都没有下划线
D**u
发帖数: 288
6
sqlite-netFx45-binary-bundle-x64-2012-1.0.84.0.zip
D**u
发帖数: 288
7
成了,hoho
换了一个
Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.
5)
之前的是 Precompiled Binaries 不行。
然后这次换了一个错误Unable to load DLL 'SQLite.Interop.dll': The specified
module could not be found. (Exception from HRESULT: 0x8007007E)
然后google到这个
http://stackoverflow.com/questions/13028069/unable-to-load-dll-
再按照这个方法
following steps:
Open the project designer in Visual Studio.
Click on the Build tab.
Disable the prefer 32-bit option.
就可以用了
convergence 谢谢你哈,以后再向你请教
居然就可以用了,晕,也不知道为啥Precompiled Binaries 不行。
D**u
发帖数: 288
8
难道key是 Disable the prefer 32-bit option
1 (共1页)
进入Programming版参与讨论
相关主题
Windows下如何设置自己的DNS?fossil 不错
Please recommend embedded RDBMS for .Net 2.0 (转载)问一个简单的binary tree 问题
构建一个快速查询字典(数据结构题)?请问大家一个eclipse CDT的问题 (转载)
visual c++ project property设置问题FYI, vs2012 supports XP server 2003 now
A string replacement problem from leetcodeJava10年前的崛起是技术到达一定成熟度的标志
VS2012太垃圾了VS2012 C# programing questions for record antomation test
我老版问我要做一个ribbon for WPF project, 从哪开始呀? (转载)
想自己搞一light weight in memory数据库in C#,求教大家c++开发GUI用什么工具?
相关话题的讨论汇总
话题: using话题: sqlitecon话题: text话题: vs2012