I want my c # program to take the data from the mysql database and save that data to a variable type double. I was trying but I still can't do it.
`
MySqlDataReader read = null;
string selectCmd = "SELECT Saldo from cuentas where NoCuenta=" + cuenta + ";";
MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2 = new MySqlCommand(selectCmd, MyConn2);
MyConn2.Open();
read = MyCommand2.ExecuteReader();
MessageBox.Show("read: " +read);
bool saldoI = read.Read();
double saldo = Convert.ToDouble(saldoI);
MessageBox.Show("Aqui se muestra el saldo inicial " + read);
double saldoFinal = saldo - monto;
`
I know that as I am transforming it from a bool type variable it returns a 1, but I require that it return the data type double. Example: 300.2