admin
2020-06-17 9d3d08ba960fc739498b0648d57eaf2c50a40fd1
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
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SQLite;
using System.Windows.Forms;
 
namespace WindowsFormsApp1.utils
{
    class SQLiteDataBaseUtil
    {
 
        SQLiteConnection con;
 
 
 
        private static SQLiteDataBaseUtil instance;
        public static SQLiteDataBaseUtil getInstance() {
            if (instance == null)
            {
                SQLiteConnection.CreateFile("BKZ");//创建数据库
                instance = new SQLiteDataBaseUtil();
                instance.con = new SQLiteConnection("Data Source=BKZ;Version=3;");
                instance.init();
            }
            return instance;
        }
 
 
        //初始化数据库
        private void init() {
            this.con = new SQLiteConnection("Data Source=record.sqlite;Version=3;");
            con.Open();
            string sql = "CREATE TABLE  IF NOT EXISTS tb_account_info (accountName varchar(128), loginState int)";
            SQLiteCommand command = new SQLiteCommand(sql, con);
            command.ExecuteNonQuery();
            con.Close();
        }
 
        //添加本地淘宝账号
        public void AddTaoBaoAccount() {
            con.Open();
            string sql = "insert into tb_account_info (accountName, loginState) values ('贺小辉1011', 1)";
            SQLiteCommand command = new SQLiteCommand(sql, con);
            command.ExecuteNonQuery();
            con.Close();
        }
 
        //查询淘宝账号
 
 
        public void ListTaoBaoAccount() {
            con.Open();
            string sql = "select * from tb_account_info";
            SQLiteCommand command = new SQLiteCommand(sql, con);
            SQLiteDataReader reader = command.ExecuteReader();
            while (reader.Read())
                Console.WriteLine("accountName: " + reader["accountName"] + "\n loginState: " + reader["loginState"]);
            Console.ReadLine();
            con.Close();
        }
 
 
        //删除淘宝账号
 
        //修改账号状态
 
 
 
 
 
 
 
    }
}