在sqlite中获取错误 [英] getting error in sqlite

查看:100
本文介绍了在sqlite中获取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
using System.Data.SqlClient;

using System.IO;
namespace sqlitesample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
           
        }



        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void insertconnect_Click(object sender, EventArgs e)
        {
            // [snip] - As C# is purely object-oriented the following lines must be put into a class:

            // We use these three SQLite objects:
            SQLiteConnection sqlite_conn;
            SQLiteCommand sqlite_cmd;
            SQLiteDataReader sqlite_datareader;

            // create a new database connection:
            sqlite_conn = new SQLiteConnection("Data Source=dbDemo.db;Version=3;New=True;Compress=True;");

            // open the connection:
            sqlite_conn.Open();

            // create a new SQL command:
            sqlite_cmd = sqlite_conn.CreateCommand();
 
        }
    }
}





之后点击按钮就会变成这个===



错误



无法加载文件或程序集'System.Data.SQLite, Version = 1.0.94.0,Culture = neutral,PublicKeyToken = db937bc2d44ff139'或其依赖项之一。试图加载一个格式不正确的程序。



by click button after that it gets like this ===

error

Could not load file or assembly 'System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format.

推荐答案

错误是错误的,你没有 System.Data.SQLite。 dll 保存在你的库文件夹(bin)中。



你应该确保你在二进制文件夹中有这个库文件(.dll) 。这样你就可以使用它了。确保允许读/写权限,并且您正在调用文件的确切名称。
The error is ovbious, you're not having the System.Data.SQLite.dll saved inside your library folder (bin).

You should make sure that you're having this library file (.dll) inside the binary folder. So that you can use it. Make sure read/write permissions are allowed and also, that you're calling the exact name of the file.


这篇关于在sqlite中获取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆