Results 1 to 7 of 7

Thread: String. as simple as that

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    4

    Angry

    Hi,

    I am new to VB. I am running VB6 sp3 on Win98.

    I have a program querying a db.

    When constructing a query, I compose it using String fragments like:

    Dim SQL As String

    ...

    SQL = SQL & " And PPC.PNO = SPD.PNO "

    When I hit 250 char limit, nothing get's appended anymore.
    What do I do wrong?

    Thanx,
    Cristi

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Limit? Maybe i am being dumb, as i have not had to write any SQL satements in a while, but where is the 250 character limit comming from?
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    4
    You tell me :-(

    I just found that after 250 chars nothing gets appended anymore to the string. No matter how many

    SQL = SQL & "blah blah"

    I add, I can't get past 250 chars limit.

    It doesn't have anything to do with SQL, I may try to compose a recipe for strawberrypie this way (appending small amounts of chars at a time) and still cannot pass over 250 chars limit.

  4. #4
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    I don't understand. This is just a sample of code to build a 500 cahracter string in small portions.

    It seems to work.

    Code:
    Private Sub Command4_Click()
        Dim SQL As String
        Dim ictr As Integer
        
        For ictr = 1 To 100
          SQL = SQL & String(5, Chr((200 * Rnd) + 55))
        Next ictr
        
        MsgBox SQL
        
    End Sub
    Iain, thats with an i by the way!

  5. #5
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    You're not using a fixed-length string, are you? (From your example it appeared like you were not.)

    In other words, this should not give you a problem:
    Dim SQL As String

    But this would:
    Dim SQL As String * 250

    With the String * 250, anything you try to append to it after the 250th character would be lost. I can't think of what else might be causing your problem.
    "It's cold gin time again ..."

    Check out my website here.

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    4

    Angry

    Maybe the String gets right.
    I try to see it in the Watch window.
    Where I can see max 250 chars of it.
    Which makes me mad because I want to run my query by hand to see exactly what are the results.

    Is there any way to get this info out from VB6 SP3? I don't want a message box :-(

  7. #7
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    You mean you want to see the query?

    Try
    Code:
    Debug.Print SQL
    This will print the string held in SQL to the immediate window. Hope this is what you are after.
    Iain, thats with an i by the way!

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