예제 #1
0
 public int Save(IList<Model.DataBean> list)
 {
     int i = 0;
     object result;
     AccessHelper db = new AccessHelper();
     foreach (var item in list)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append("INSERT INTO SalesRecord ( ScZydBh, ScBh, ScDj, ScZl, JyTime, State,JyJlID ) ");
         sb.Append("values( '" + item.ZydBh + "','" + item.ShcBh + "','" + item.ShcDj + "','" + item.XSSL + "','" +
                   item.XSTime + "','0','" + item.JyJlID + "')");
         OleDbCommand cmd = db.GetSqlStringCommand(sb.ToString());
         result = db.ExecuteNonQuery(cmd); //.ExecuteNonQuery(cmd);
         i += result == null ? -1 : Convert.ToInt16(result);
     }
     return i;
 }
예제 #2
0
 public int UpdateState(IList<DataBean> list )
 {
     object result;
     AccessHelper db = new AccessHelper();
     StringBuilder sb=new StringBuilder();
     foreach (var item in list)
     {
         sb.Append("," + item.ID + "");
     }
     StringBuilder sbs = new StringBuilder();
     sbs.Append("update SalesRecord set State=2 where ID in("+sb.ToString().Substring(1)+") ");
     OleDbCommand cmd = db.GetSqlStringCommand(sbs.ToString());
     result = db.ExecuteNonQuery(cmd);
     return result == null ? -1 : Convert.ToInt16(result);
 }