I am loading data from a MySQL database into a C # .NET application. The data is stored in the database as DBType.Double, but for use in my application I use Decimal with Convert.ToDecimal (). The data is the positional data used when shooting, and can be used to display a 3D model in the Direct3D window.
When the Direct3D window and therefore the Direct3D DLL do not load, the conversion works fine, so values โโlike 1769301.6485186936, 5880300.8152837148 stored in the database are loaded as 1769301.64851869, 5880300.81528371. However, if I downloaded the Direct3D module, then the conversion leads to the same values โโthat are converted to 1769301.7112576, 5880300.79401984.
The base code is as follows: a vertex is a class / structure of three decimal values, X, Y and Z.
List<vertex> positions = new List<vertex>(); using (MySqlCommand cmd = new MySqlCommand("SELECT x, y, z FROM positionTable;", conn)) { MySqlDataReader dr = cmd.ExecuteReader(); try { while (dr.Read()) { vertex position = new vertex(); position.X = Convert.ToDecimal(dr[0]); position.Y = Convert.ToDecimal(dr[1]); position.Z = Convert.ToDecimal(dr[2]); positions.Add(position); } } }
jonew source share