title: Varchar Sql Server Sum
body: <p>I have ms access database and i want convert Sql Server.</p>
  
  <p>My txttotal column have a (<code>15,50 1,25 10,00</code>) value
  My Sum function great work my old access database this query:</p>
  
  <pre><code> dtfr = DateTimePicker1.Value 
   dtto = DateTimePicker2.Value
  
  
  
  sqlcmd = "SELECT SUM(txttotal) as Total from table WHERE odate &gt;=  CDate('" + dtfr + "') AND  odate &lt;= CDate('" + dtto + "')"
  </code></pre>
  
  <p>Access retrieve True value (26,75)</p>
  
  <p>But i tried Sql Server using this query:</p>
  
  <pre><code>sqlcmd = "SELECT SUM(CAST(txttotal as ?)) as Total from table WHERE odate BETWEEN '" + dtfr + "' AND '" + dtto + "'"
  </code></pre>
  
  <p>?= I tried float,int,double</p>
  
  <p>SqlException "<strong>Error converting data type varchar to float</strong>"</p>
  
  <p><strong>Edit: my txttotal column is varchar</strong></p>