1 | using System;
|
---|
2 | using System.Text;
|
---|
3 | using System.Data.SQLite;
|
---|
4 |
|
---|
5 | namespace MyApp
|
---|
6 | {
|
---|
7 | class Program
|
---|
8 | {
|
---|
9 | static void Main(string[] args)
|
---|
10 | {
|
---|
11 | Console.WriteLine("Hello World!");
|
---|
12 | Console.WriteLine("The current time is " + DateTime.Now);
|
---|
13 |
|
---|
14 | string _sDatabasePassword = "WeLcOmE2IvYiOt'sVMS.db";
|
---|
15 |
|
---|
16 | string cs = "Data Source=C:\\Users\\info\\MyApp\\VMS.db;Password=" + _sDatabasePassword;
|
---|
17 |
|
---|
18 |
|
---|
19 | var con = new SQLiteConnection(cs);
|
---|
20 | con.Open();
|
---|
21 |
|
---|
22 | /* Validate succesfull access to database */
|
---|
23 | string stm = "SELECT name FROM sqlite_master WHERE type='table';";
|
---|
24 | var cmd = new SQLiteCommand(stm, con);
|
---|
25 | string result = cmd.ExecuteScalar().ToString();
|
---|
26 | Console.WriteLine($"SQLite result: {result}");
|
---|
27 |
|
---|
28 | // Remove Password from database
|
---|
29 | con.ChangePassword(String.Empty);
|
---|
30 |
|
---|
31 | con.Close();
|
---|
32 | }
|
---|
33 | }
|
---|
34 | }
|
---|