public int MoChot(DOChot info,string TableName) { DatabaseFB db = HelpDB.getDatabase(); string sql = "delete from " + TableName + " where NGAY = @NGAY"; DbCommand cmd = db.GetSQLStringCommand(sql); db.AddInParameter(cmd, "@NGAY", DbType.DateTime, info.Ngay); return db.ExecuteNonQuery(cmd); }
public void ChotBangChamCong(DateTime []dsNgayChot,string TableName,string GenName) { foreach (DateTime item in dsNgayChot) { DOChot info = new DOChot { ID = HelpDB.getDatabase().GetID(GenName), Ngay = item }; Chot(info,TableName); } }
public int Chot(DOChot info,string TableName) { if (!this.TonTai(info.Ngay,TableName)) { string sql = "insert into " + TableName + "(ID,NGAY) values(@ID,@NGAY)"; DatabaseFB db = HelpDB.getDatabase(); DbCommand cmd = db.GetSQLStringCommand(sql); db.AddInParameter(cmd, "@ID", System.Data.DbType.Int64, info.ID); db.AddInParameter(cmd, "@NGAY", System.Data.DbType.DateTime, info.Ngay); return db.ExecuteNonQuery(cmd); } return -1; }