SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Asp insert into access using double deletes beginning zeros

    Hello,

    I'm trying to input data into an access database using asp and I'm using double as the number field type in access. And whenever the number is inserted it is around 9 digits sometimes the number begins with 2 zeros but when inserted the beginning zeros are deleted.

    How can I have the number inserted and keep the initial zeros?

    Thanks,
    James

  2. #2
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can't with a double data type. you'll have to change the type to text...

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will any of the other number fields retain the beginning zeros?

    Thanks for your help,
    James

  4. #4
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope, since real numbers don't begin in zero. do you really need it as a double?

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it doesn't really have to be a double I suppose. The only requirement was that it be 9 digits long that's why I made it a double.

    Thanks,
    James

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I talked to the client and text was acceptable so I just changing that particular field to a text field.

    Thanks for your help,
    James

  7. #7
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can check the length of a string and make sure that is 9 characters long:
    Code:
    if len(mystring)>9 then
        ' do something about
    end if
    i'm assuming that this is coming from a form or something. you can also do some JavaScript validation to make sure that the input is the correct length. And, if this is indeed coming from a form, set the max size of the form field to 9.

  8. #8
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help. Yes the data is being collected from a form and a javascript validation would probably be best.


Bookmarks

Posting Permissions

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