I have a MySQL database with the table "Products
". A column in "Products
" is called "Price
" and has the datatype "double
".
I need to retrieve the values from that column, so I create a reader, etc.:
MySQLCommand cmd = new MySQLCommand("SELECT Price FROM Products", connection);
MySQLDataReader reader = cmd.ExecuteReaderEx();
if (reader.HasRows == true)
{
while (reader.Read() == true)
{
price = reader["Price"]).ToString();
}
}
Problem is that price isn't set to the expected value. If the value in the database is "299.95", price is set to "29995.0".
Any idea why this is happening? And what can be done to fix it?