예제 #1
0
 public static bool addNewEvent(CalendarEvent e)
 {
     using (SqlConnection sqlConnection = new SqlConnection(CONNECTION_STRING))
     {
         sqlConnection.Open();
         using (SqlCommand sqlCommand = new SqlCommand("INSERT INTO CalendarEvent (Name, Start, [End], CalendarId, Type) "+
             "VALUES ('" + e.getName() + "','" + e.getStart().ToString() + "','" + e.getEnd().ToString() + "'," + e.getCalendarId() +
             ",'" + e.getType() + "')", sqlConnection))
         {
             using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
             {
                 sqlDataReader.Close();
             }
         }
         sqlConnection.Close();
     }
     return true;
 }