-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
66 lines (58 loc) · 2.1 KB
/
Program.cs
File metadata and controls
66 lines (58 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Configuration;
using System.Data.SQLite;
using System.Windows.Forms;
namespace WindowsFormsApp4
{
internal static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
InitializeDatabase();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
private static void InitializeDatabase()
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
conn.Open();
string createTableQuery = @"
CREATE TABLE IF NOT EXISTS Users (
id_user INTEGER PRIMARY KEY,
user_RUB INTEGER,
user_HKD INTEGER,
credit INTEGER,
deposit INTEGER
)";
string insertDataQuery = @"
INSERT OR IGNORE INTO Users (id_user, user_RUB, user_HKD, credit, deposit)
VALUES
(0, 10000, 0, 0, 0),
(1, 10000, 0, 0, 0),
(2, 10000, 0, 0, 0),
(3, 10000, 0, 0, 0),
(4, 10000, 0, 0, 0),
(5, 10000, 0, 0, 0),
(6, 10000, 0, 0, 0),
(7, 10000, 0, 0, 0),
(8, 10000, 0, 0, 0),
(9, 10000, 0, 0, 0)";
using (SQLiteCommand cmd = new SQLiteCommand(createTableQuery, conn))
{
cmd.ExecuteNonQuery();
}
using (SQLiteCommand cmd = new SQLiteCommand(insertDataQuery, conn))
{
cmd.ExecuteNonQuery();
}
}
}
}
}