title: How can I update edit the Date & Time into the SQL database on server side
body: <p>I am new in writing code, I have some following issues when I want to edit the database on the server-side. Date, StartTime &amp; EndTime cannot be read when edit.</p>
  <pre><code>          // This method is used to select the EVENT data from the database
              SqlCommand UpdateEvent = new SqlCommand
              {
                  CommandText = &quot;SELECT * FROM EVENT WHERE Event_ID = &quot; + Event_ID,
                  CommandType = CommandType.Text,
                  Connection = con
              };
  
              con.Open(); // Open the database connection
  
              // This function is uses to output the existing COMPETITOR infomation in the database for edit purpose
              if (con.State == ConnectionState.Open)  // If the database connection is open, execute the following code
              {
                  SqlDataReader readEvent = UpdateEvent.ExecuteReader();
                  while (readEvent.Read()) //Check the EVENT infomation
                  {  
                      this.EventNameHeader.InnerHtml = &quot;&lt;h2 class='standardheader'&gt;Update &quot; + readEvent.GetInt32(1) + &quot;&lt;/h2&gt;&quot;;
                      this.CtrlEvent_ID.Value = readEvent.GetInt32(0).ToString();
                      this.CtrlG_ID.Text = readEvent.GetInt32(1).ToString();
                      this.CtrlF_Event.Text = readEvent.GetString(2);
                      this.CtrlE_Venue.Text = readEvent.GetString(3);
                      this.CtrlE_Date.Value = readEvent.GetDateTime(4).Date.ToString(&quot;dd-MM-YYYY&quot;);
                      this.CtrlE_StartTime.SelectedValue = readEvent.GetTimeSpan(5).ToString(&quot;HH:mm:ss&quot;);
                      this.CtrlE_EndTime.SelectedValue = readEvent.GetTimeSpan(6).ToString(&quot;HH:mm:ss&quot;);
                      this.CtrlE_Desc.Text = readEvent.GetString(7);
                      this.CtrlW_Record.Text = readEvent.GetString(8);
                  }
              }
              else
              {
                  Response.Write(&quot;SQL DB Connect Failed&quot;);
              }
  
              con.Close();   // Close the connection to END the EVENT creation
          }
      }
  </code></pre>