Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004

    Unanswered: ADP and Stored Proc - Inserting Incorrect Decimal Values

    I have an Acess Data project with an Unbound Form that Executes a Stored Procedure to Insert Values into a Table.

    One of the parameters in the Stored Procedure is @testdecimal

    When I insert the Record the decimal value is rounding up or down

    ex: 12.46 will insert 13.00 and 12.35 will insert 12.00

    the code used to insert the record is below:

    --- begin code

    Dim strSQL As String

    'Execute the Stored Procedure and Set the Parameters to the Textboxes on the Form

    strSQL = "Exec spInsertTestItem '" & Me.testtext & "' ," & Me.testid & "," & Me.testdecimal & "," & Me.testmoney '

    CurrentProject.Connection.Execute strSQL

    --- end code

    the stored procedure is below:

    --- begin sp

    INSERT INTO dbo.tblTestInsert
    (testtext, testid, testdecimal, testmoney)
    VALUES (@testtext, @testid, @testdecimal, @testcurrency)

    --- end sp

  2. #2
    Join Date
    Jul 2003
    2 things to check:
    If Me.Testdecimal is bound, what format is the field it is bound to?

    How is the @testdecimal being received as a parameter into your Sproc?
    The first line of your sproc looks something like:
    CREATE PROCEDURE spInsertTestItem
    @testtext varchar(50)
    @testid INT
    @testdecimal DECIMAL

    If testdecimal says INT instead of Decimal, it will be converted to integer.
    Inspiration Through Fermentation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts