How can i convert from sql money datatype to double in c#.
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();
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.