locked
VB.NET - Access DB Update storing numbers as integer instead of decimal RRS feed

  • Question

  • I am taking data from a datagridview and storing it in an Access 2007 DB table
    using the Datatset/TableAdapter Update command.


    'Add rows to Table'

    FoodDatabaseDataSet.Meals.Rows.InsertAt(DR, MealsRwCnt)


    'Update Data Base'


     Try
        Me.Validate()
        MealsBindingSource.EndEdit()
        MealsTableAdapter.Update(FoodDatabaseDataSet.Meals)
     Catch ex As Exception
        MsgBox(ex.ToString)
     End Try

     
    The update works fine storing all data in the Access DB table. The problem I'm having
    is that the data is stored in the DB in integer format instead of decimal format
    (anything less than zero is stored as a zero)
     
    While the app is running and after an update, on another datagridview populated by the DB data, data is diplayed in decimal format.
    It appears that the Dataset.DataTable is updated correctly but not the ACCESS DB table.


    Any help will be appreciated

    Thank You

    Monday, October 25, 2010 4:31 PM

Answers

  • I figured out the problem. Had to set the "Scale" parameters in the Access database fields.

    The "Scale" parameter determines the number of places to the right of the decimal place.

    Learn something new every project.

    • Marked as answer by Helen Zhou Friday, October 29, 2010 1:06 AM
    Tuesday, October 26, 2010 7:51 PM