예제 #1
0
 //更新数据
 public void Update(PrincipalEntity PE)
 {
     SQLiteCommand cmd = new SQLiteCommand(conn);
     cmd.CommandText = "update '" + user + "_Principal' set money=@money";
     cmd.Parameters.Add(new SQLiteParameter("money", PE.money));
     cmd.ExecuteNonQuery();
 }
예제 #2
0
 //插入数据
 public void Insert(PrincipalEntity PE)
 {
     SQLiteCommand cmd = new SQLiteCommand(conn);
     cmd.CommandText = "insert into '" + user + "_Principal' values(@money)";
     cmd.Parameters.Add(new SQLiteParameter("money", PE.money));
     cmd.ExecuteNonQuery();
 }
예제 #3
0
 //读取数据
 public void Select(out PrincipalEntity PE)
 {
     SQLiteCommand cmd = new SQLiteCommand(conn);
     cmd.CommandText = "select * from '" + user + "_Principal'";
     SQLiteDataReader reader = cmd.ExecuteReader();
     PE = new PrincipalEntity();
     if (reader.HasRows)
     {
         if (reader.Read())
         {
             PE.money = reader.GetValue(0).ToString();
         }
     }
 }
예제 #4
0
 //写入本金
 private void PrincipalWrite(double m)
 {
     PrincipalEntity PE = new PrincipalEntity();
     PE.money = m.ToString();
     principal.Update(PE);
     money.principal = m;
 }
예제 #5
0
 //创建本金
 public void PrincipalCreate(double m)
 {
     PrincipalEntity PE = new PrincipalEntity();
     PE.money = m.ToString();
     principal.Insert(PE);
     //本金与现金创建
     money.principal = m;
     money.now = m;
     //交易记录创建持股表
     StockHold_Init();
 }