EDN Admin
Well-known member
I have a program that does everything i want except for the fact it is rounding off a decimal that makes the data and program useless. This is only when updating the table.
I am tracking hours played in a game. I also track points as well. My points will write in decimal my hours round off, I dont see that the tables in the data base (its an access 2000 database) are set up different in access or anywhere in visual studio. One works, one does not.
As an example for a test I coded this to a button
(testgarbage is dimmed as decimal )
testgarbage = 1000.44
TrackstarDataSet.eventlog.Rows(1).Item(5) = testgarbage
Me.EventlogBindingSource.EndEdit()
Me.EventlogTableAdapter.Update(Me.TrackstarDataSet.eventlog)
any text box or anything set to display testgarbage will be 1000.44
but what gets written to the database is 1000. Just using 1000.44 instead of the variable doesnt work either.
Using the show datasources and just dragging the hours field onto a blank form and letting Visual studio set up everything itself doesnt work either, still rounds off. I did set up a new project and a new database and doing drag field to form worked but it was a simple two field database and and I have way to many hours in this project to start over.
Is there anyway to stop rounding or fix it to a number of decimal places for the entire project?
I can use access to set hours to a decimal and it works there so i know the database is set up correctly. number as decimal scale 2 decimal places 2
in Visual studio I have it set to system.decimal so dont know why it just chooses to round when doing the update.
View the full article
I am tracking hours played in a game. I also track points as well. My points will write in decimal my hours round off, I dont see that the tables in the data base (its an access 2000 database) are set up different in access or anywhere in visual studio. One works, one does not.
As an example for a test I coded this to a button
(testgarbage is dimmed as decimal )
testgarbage = 1000.44
TrackstarDataSet.eventlog.Rows(1).Item(5) = testgarbage
Me.EventlogBindingSource.EndEdit()
Me.EventlogTableAdapter.Update(Me.TrackstarDataSet.eventlog)
any text box or anything set to display testgarbage will be 1000.44
but what gets written to the database is 1000. Just using 1000.44 instead of the variable doesnt work either.
Using the show datasources and just dragging the hours field onto a blank form and letting Visual studio set up everything itself doesnt work either, still rounds off. I did set up a new project and a new database and doing drag field to form worked but it was a simple two field database and and I have way to many hours in this project to start over.
Is there anyway to stop rounding or fix it to a number of decimal places for the entire project?
I can use access to set hours to a decimal and it works there so i know the database is set up correctly. number as decimal scale 2 decimal places 2
in Visual studio I have it set to system.decimal so dont know why it just chooses to round when doing the update.
View the full article