Results 1 to 5 of 5

Thread: TextBox and AS400 Database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Location
    Singapore
    Posts
    79

    TextBox and AS400 Database

    Hi! I'm using a couple of textboxes, in which I set the max lenght the user can type in to 50. I have also set the database in as400 to store 50 charachters.

    My problem is if user does not enter any data and saves his record and then want to edit his data. The data retrieve from the database will appear in the textbox as 25 spaces instead of just blanks. Which means the user can only type a few words before he is locked out as the spaces would be taking up the space in the textbox! Can anyone advise? Thanks

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    I havent used an as400 database, but it is a familiar issue.

    If you have the option to set the data type on the table to VarChar (or something similar) rather than Char the problem should be gone.


    Alternatively you could Trim the field when it is displayed (if it isn't a bound control).

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Location
    Singapore
    Posts
    79
    The problem is I don't have access to the database
    My supervisor doesnt believe its a problem with her database design... She believes its my codings which are wrong

    Could you enlighten me about triming the field when its displayed? Do you mean user triming it manually? Or thru codes?
    Thanks a lot

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    I meant automatically, but it depends on how your program is currently set up. If you use bound controls it wont work with this method, but a more complex variation should do it (I don't know how though, as I dont use bound controls!).

    If you have code like this to fill the textbox:
    VB Code:
    1. Text1.Text = recordset.Field("fieldname")
    You can just add a trim like this:
    VB Code:
    1. Text1.Text = Trim(recordset.Field("fieldname"))

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Location
    Singapore
    Posts
    79
    Thanks a lot the method works. Cheers Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width