title: Can't read float value from SQL Server database
body: <p>I use SQL Server to build my database and SqlDataReader to read data from it.</p>
  
  <pre><code>command.Connection = cn;
  command.CommandText = "SELECT * FROM test";
  SqlDataReader rd = command.ExecuteReader();
  while(rd.Read())
  {
      double d = (double) rd.GetValue(0);
  }
  </code></pre>
  
  <p>The column (0) I am trying to get value from is a 'float' type and has value '3.5' . As mapping data type from this <a href="https://docs.microsoft.com/en-us/sql/relational-databases/clr-integration-database-objects-types-net-framework/mapping-clr-parameter-data" rel="nofollow noreferrer">MSDN link</a>, the type of the object returned by rd.GetValue(0) must be 'double'. But the code above returns to variable 'd' value '0.0'. I tried this line:</p>
  
  <pre><code>double d = Convert.ToDouble(rd.GetValue(0));
  </code></pre>
  
  <p>But it still returns '0.0' to variable 'd'.</p>
  
  <p>I tried searching on Google and StackOverflow but there is no result.</p>
  
  <p>What am I missing? Help me!</p>