Richy321
Richy321

Reputation: 410

Check full value of a long string in the VB6 IDE

I have a string 'sSQL' that contains a very long tsql statement. I need to check what its value is while debugging. I usually just use ?sSQL in the immediate window but this is truncating the first half and only giving me the end half.

So is there an alternative way to see the full value using the vb6 sp5 dev environment?

Upvotes: 8

Views: 7852

Answers (6)

scor4er
scor4er

Reputation: 1589

While execution is paused on the breakpoint you could type in the immediate window:

Debug.Print(sSql)

;-)

Upvotes: 9

Deanna
Deanna

Reputation: 24283

For debugging, Clipboard.Clear: Clipboard.SetText ssql then paste into notepad.

Upvotes: 15

Deanna
Deanna

Reputation: 24283

Erm, the immediate window doesn't truncate (except at 200 lines of 1023 characters). Have you just tried pressing the home key or scrolling left?

Upvotes: 2

Carlos Quintanilla
Carlos Quintanilla

Reputation: 13323

Check the length of the "long" string using the Immediate:

?len(sSQL)
 4221 

then knowing the size you can start getting chunks of string using Mid function:

?Mid(sSQL, 1, 500)

?Mid(sSQL, 500, 1000)

?Mid(sSQL, 1000, 1500)

Upvotes: 1

Jon Egerton
Jon Egerton

Reputation: 41569

One way is to use write the string out to a file. You can do this in a single line in the immediate window by using Line continuations, e.g.:

Open "C:\SQL.TXT" For Append As #1: Write #1,sSQL : Close #1

Note: You'll need to change C:\SQL.Txt to a path that you can write to depending on your OS.

Upvotes: 7

GSerg
GSerg

Reputation: 78190

If it's that long, save it to a text file. Have a debug method:

sub SaveStringToDebugFile(s as string)
  ...
end sub

and then call it from the immediate window:

SaveStringToDebugFile sSQL

Upvotes: 5

Related Questions