I'm having a problem getting Sqlite to work in my c# irc bot.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SQLite;
using System.IO;
namespace ModBot
{
class Database
{
private SQLiteConnection myDB;
private SQLiteCommand cmd;
public Database()
{
InitializeDB();
}
private void InitializeDB()
{
if (File.Exists("ModBot.db"))
{
Console.WriteLine("HEYOOOOOOO");
myDB = new SQLiteConnection("Data Source=ModBot.db;Version=3;");
String sql = "CREATE TABLE IF NOT EXISTS twitch (id INTEGER PRIMARY KEY, user TEXT, currency INTEGER DEFAULT 0, subscriber INTEGER DEFAULT 0, btag TEXT DEFAULT null);";
cmd = new SQLiteCommand(sql, myDB);
cmd.ExecuteNonQuery();
}
else
{
Console.WriteLine("YOOHOOOOO");
SQLiteConnection.CreateFile("ModBot.db");
myDB = new SQLiteConnection("Data Source=ModBot.db;Version=3;");
String sql = "CREATE TABLE IF NOT EXISTS twitch (id INTEGER PRIMARY KEY, user TEXT, currency INTEGER DEFAULT 0, subscriber INTEGER DEFAULT 0, btag TEXT DEFAULT null);";
cmd = new SQLiteCommand(sql, myDB);
cmd.ExecuteNonQuery();
}
}
}
}
I downloaded System.Data.Sqlite, and added it as a resource to my project. When I run the code, it throws a DllNotFound exception (Specifically: Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)) when it tries to make the actual connection.
Any ideas?