How can i convert from sql money datatype to double in c#.

I first cast it to a string, then to a double and it worked:

using(SqlConnection conn = new SqlConnection(CDB_SqlLister.csb.ToString()))
         {
            conn.Open();

            string strSQL = "SELECT * from E.dbo.has_money";
            using (SqlDataReader rdr = (new SqlCommand(strSQL, conn)).ExecuteReader())
            {
               while (rdr.Read())
               {
                  Console.WriteLine(double.Parse(rdr["mnyOne"].ToString()));
               }

               rdr.Close();
            }

            conn.Close();
         }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.