Answers for "connecting to sqlite database from C#"

C#
1

sqlite connection c#

//Download "System.Data.Sqlite" from "Manage Nuget Packages" Section
using System.Data.SQLite;
SQLiteConnection.CreateFile("TestDB.db3") //Create a Database
SQLiteConnection conn = new SQLiteConnection(@"data source = TestDB.db3"); //Establish a connection with our created DB
conn.Open();
SQLiteCommand cmd = new SQLiteCommand("create table table1 (username TEXT, password TEXT)", conn);
cmd.ExecuteNonQuery();
Console.WriteLine("Enter the username");
string UserName = Console.ReadLine();
Console.WriteLine("Enter Password");
string PassWord = Console.ReadLine();
SQLiteCommand cmd2 = new SQLiteCommand("insert into table1 (username, password) values ('"+Username+"', '"+PassWord+"')", conn);
cmd2.ExecuteNonQuery();
Posted by: Guest on April-28-2020

Code answers related to "connecting to sqlite database from C#"

C# Answers by Framework

Browse Popular Code Answers by Language