Results 1 to 11 of 11

Thread: Long strings show garbage???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Montréal, Québec Canada
    Posts
    202

    Long strings show garbage???

    Hail,

    I have a recordset (ADO) that should return a string of about 308 characters in one of the fields, instead it returns almost the whole string then cuts off and either shows garbage characters or nothing at all depending on each run??? Is it because the string is more than 255 characters? Anyone have any idea why it's doing this?

    Phailak

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Long strings show garbage???

    It could be a 255(ish) limit.

    What database system are you using (Access/SQL Server/etc)?
    What data type is the field that has the issue?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Montréal, Québec Canada
    Posts
    202

    Re: Long strings show garbage???

    Quote Originally Posted by si_the_geek
    It could be a 255(ish) limit.

    What database system are you using (Access/SQL Server/etc)?
    What data type is the field that has the issue?
    It is a 255 limit thing. I'm using Access 2003, and the field basically concatenates a few Memo fields, guess it doesn't like that...

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Long strings show garbage???

    Ah yes, Memo is a strange data type unfortunately.

    How are you concatenating?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Montréal, Québec Canada
    Posts
    202

    Re: Long strings show garbage???

    Just putting field1 & ' - ' & Field2 & ' - ' & field3... up to field5

    All records under 255 work fine

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Long strings show garbage???

    I would recommend bringing back the fields seperately, then concatenating them in your program.

    If this isn't possible (or it doesnt work), where are you displaying the data? (nb: if you are looking at it in the Watch window in VB, that can only show 255 chars).

  7. #7
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Long strings show garbage???

    Phailak,

    If you must use a large amount of data in a field in Access use the Ole Object field. Use GetChunk and AppendChunk to manipulate the data.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Montréal, Québec Canada
    Posts
    202

    Re: Long strings show garbage???

    I'm using data report to display the data, so I have to use a recordset right? Also means I cannot bring them in seperately...

  9. #9
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Long strings show garbage???

    Phailak,

    Translation Please....

  10. #10
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: Long strings show garbage???

    Quote Originally Posted by Phailak
    I have a recordset (ADO) that should return a string of about 308 characters in one of the fields, instead it returns almost the whole string Phailak
    I can't understand the above sentence, if you are retrieving the data from the field of course it will return the whole string and not just 308 characters.

    Quote Originally Posted by Phailak
    then cuts off and either shows garbage characters or nothing at all depending on each run??? Is it because the string is more than 255 characters? Anyone have any idea why it's doing this?
    How are you saving in the field? Those garbage maybe vbCrLf characters... Are you using Memo? If you are then it could handle more than 255 characters...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  11. #11
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Long strings show garbage???

    The trouble is that Phailak is combining a few memo fields, and unfortunately due to the usage it does need to be in the SQL.

    You'll need to work the data a bit, I'm not sure quite how tho. Try these methods to see if they help:

    Trim(field1) & ' - ' & Trim(Field2) & ' - ' & ...

    Left(field1,Len(field1)) & ' - ' & Left(Field2, Len(Field2)) & ' - ' & ...

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