· 8 years ago · Mar 26, 2018, 11:42 AM
1 static class Program
2 {
3
4 static SQLiteConnection DB;
5 static string createtable =
6 "CREATE TABLE IF NOT EXISTS passwords(passwordID INTEGER PRIMARY KEY, Name TEXT, Domain TEXT, Benutzername TEXT, PW TEXT)";
7
8 [STAThread]
9 static void Main()
10 {
11 DB = getSQL("DatenbankPW.db");
12 DB.Open();
13 new SQLiteCommand(createtable, DB).ExecuteNonQuery();
14
15
16 string test =
17 "INSERT INTO passwords(passwordID, Name, Domain, Benutzername, PW) VALUES ('1', 'Fabian', 'Fabian.de','Fabian','TEST')";
18 SQLiteCommand Command = new SQLiteCommand(test, DB);
19 Command.ExecuteNonQuery();
20
21 Application.EnableVisualStyles();
22 Application.SetCompatibleTextRenderingDefault(false);
23 Application.Run(new Form1());
24 }
25
26
27 static SQLiteConnection getSQL (string path)
28 {
29 if (!File.Exists(path))
30 SQLiteConnection.CreateFile(path);
31
32 return new SQLiteConnection($"Data Source={path};Version=3;");
33
34
35
36
37 }
38 }