Skip to content

2D-Mesh-Plane/SqlLiteUtils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SqlLiteUtils


You will need to download the nuget package System.Data.SQLite .

Then add the binary to dependencies.

Code to make simple database

SqlDatabase database = new SqlDatabase("test2.db");
List<string> colNames = new List<string>();
colNames.Add("name"); // INDEX 0 COLL 0
colNames.Add("age"); //INDEX 1 COLL 1


List<DataTypes> dataTypes = new List<DataTypes>();
dataTypes.Add(DataTypes.TEXT); // Data type for COLL 0
dataTypes.Add(DataTypes.INT); // Data type for COLL 1

database.CreateTable("deez", colNames, dataTypes); // <- creates the table

List<string> data = new List<string>();
data.Add("John"); // Data for COLL 0
data.Add("40");  // Data for COLL 1

database.InsertData("deez", data, colNames, dataTypes); // <- Inserts the data into the table

List<string> colls = new List<string>();
colls.Add("age");
colls.Add("name");

List<string> dataR = database.ReadData("deez", colls); // <- Reads the data for the specific colls
database.Close(); // <- closes the database

foreach (var d in dataR)
{
    Console.WriteLine(d);
}


Recommendation:


Use MySql. SQLite isn't the best database type!