예제 #1
0
 public void Update(Reservation rsvObj, int id)
 {
     string sqlStr =
        string.Format(
        "Update Reservation Set RV_Person = '{0}', RV_Date = '{1}', RV_TimeFrom = '{2}', RV_TimeTo = '{3}' Where RV_ID = '{4}'",
        rsvObj.Person, rsvObj.Date, rsvObj.TimeFrom, rsvObj.TimeTo, id);
     using (SqlCommand cmd = new SqlCommand(sqlStr, this.SqlCn))
     {
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch (SqlException ex)
         {
             Exception error = new Exception("Couldn't update the Reservation! " + ex.Message, ex);
             throw error;
         }
     }
 }
예제 #2
0
 // reservation
 public void Insert(Reservation rsvObj, int id)
 {
     string sqlStr =
        string.Format(
            "Insert into Reservation (RV_R_ID, RV_Person, RV_Date, RV_TimeFrom, RV_TimeTo) Values" +
            "('{0}', '{1}', '{2}', '{3}', '{4}')", id, rsvObj.Person, rsvObj.Date, rsvObj.TimeFrom, rsvObj.TimeTo);
     using (SqlCommand cmd = new SqlCommand(sqlStr, this.SqlCn))
     {
         try
         {
             cmd.ExecuteNonQuery();
         }
         catch (SqlException ex)
         {
             Exception error = new Exception("Couldn't insert the Reservation! " + ex.Message, ex);
             throw error;
         }
     }
 }