I just started to use SQLite. Doesn't seem to look like MySQL and SQL Server and MS Access that I use. I sought for several information online, nothing I could really find as well I decided to post here.
It connects well, and the libraries are present in the folder, but when I try to insert into the database, it throws an exception to the console.
My code looks like this
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Data.SQLite;
namespace sqliteInsert
{
class Program
{
static void Main(string[] args)
{
string constring = "Data Source=C:\\Users\\DornellPC\\Desktop\\people_db.db;Version=3;New=False;Compress=True;";
using (SQLiteConnection con = new SQLiteConnection(constring))
{
try
{
string sql = "insert into people_data (first_name,last_name,tel,email) values ('Jack','Darwin','0966358936','j_darwin@fsmail.net')";
con.Open();
Console.WriteLine("Connection open!");
using (SQLiteCommand cmd = new SQLiteCommand(sql,con))
{
cmd.ExecuteNonQuery();
Console.WriteLine("Success!");
Console.ReadLine();
}
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
}
}
and no information has been inserted into the database as it throws this exception:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'System.Data.SQLite, Version=1.0.105.2, Culture=neutral, PublicKeyToken=db 937bc2d44ff139' or one of its dependencies. The system cannot find the file specified.
at sqliteInsert.Program.Main(String[] args)