title: Convert TimeSpan to Int
body: <p>I have a <code>Vacation</code> table which consists of three columns as following:</p>
  
  <p>Balance       varchar(20), 
  National_ID   varchar(15), 
  NoOfDays      varchar(20), </p>
  
  <p>I use this code to update table values:</p>
  
  <pre><code>protected void btnadd_Click(object sender, EventArgs e)
      {
          TimeSpan remaindate;
          DateTime start = DateTime.Parse(tbstartvaca.Text).Date;
          DateTime end = DateTime.Parse(tbendvaca.Text).Date;
          TimeSpan vacation = TimeSpan.Parse(lbldays.Text);
          TimeSpan total;
          if (start &gt; end)
          {
              lberr.Text = "Please check again on Starting date";
              return;
          }
          else
          {
              remaindate = end - start;
              lberr.Text = "you have left with " + remaindate.TotalDays + "days.";
              total = vacation - remaindate;
              lbldays.Text = "you have left with " + total.TotalDays + "days.";
              s = "Update Vacation set Balance = '" + total + "', NoOfDays ='" + remaindate + "' where National_ID = '" + lblid.Text+ "'";
              if (db.Run(s))
              {
                  //lberr.Text = "The data has update";
              }
  
              else
              {
                  lberr.Text = "The data has not update";
              }
          }
  
      }
  </code></pre>
  
  <p>How can I change the type of data from <code>TimeSpan</code> to <code>integer</code> with variable and total after calculated formula to save a value in the table as int?</p>
  
  <p>Please note that I changed the type of values to varchar(20) with Balance and NoOfDays to make the project work.</p>