/// <summary> /// 成交寫入資料庫 /// </summary> /// <param name="o"></param> private void Match2SQL(OrderProcessor.Capital.Order o) { string date = DateTime.Now.ToString("yyyy/MM/dd"); string qrysql = $"SELECT COUNT(*) FROM CAPITALMATCH WHERE DATE='{date}' AND ORDNO='{ o.OrdNo}'"; DataTable dt = m_SQL.DoQuery(qrysql); if (dt.Rows[0][0].ToInt() <= 0) { string sql = $"INSERT INTO CAPITALMATCH ([DATE],ORDNO,CUSTNO,COMID,SIDE,LOTS,PRICE,TIME) VALUES ('{date}','{o.OrdNo}','{o.CustNo}','{o.ComID}',{(o.BuySell == OrderProcessor.Side.B ? 0 : 1)},{o.Qty},{o.Price},'{o.Time}')"; try { m_SQL.DoExecute(sql); } catch (Exception) { } } }