Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum string length in VB 1

Status
Not open for further replies.

rarogersonkf

Programmer
Aug 23, 2005
23
0
0
CA
I am creating an SQL statement by concatenation as follows:

Dim DataLib As String
Dim Stmt As String

DataLib = "Mylib"

Stmt = ""
Stmt = Stmt & "SELECT USRDPT, PRIOR, CONCAT(DESC1, DESC2) AS DESC, "
Stmt = Stmt & " CONCAT(A.STATUS, CONCAT(' - ',"
Stmt = Stmt & " (SELECT PARD33 FROM " + DataLib + ".KFP33C WHERE TYPE33 = 'STAT' AND SEAK33 = A.STATUS))) AS STATUS, "
Stmt = Stmt & " PROJ#, PHASE#, PEDAT, AEDAT, UTSDAT, PTOTMD, ATMDAY"
Stmt = Stmt & " FROM " + DataLib + ".KFP34 A"

When I put the code in debug Stmt is built correctly until the final line (the from clause). This line is not appended.
Is there a restriction of the length of the string Stmt?

Thanks in advance for your help.

Rob
 
try changing the + in the line to &
Stmt = Stmt & " FROM " & DataLib & ".KFP34 A"

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I tried what you suggested but it did not make a difference. Next idea? lol

Thanks,

Rob
 
No ideas because it works fine for me. If you Debug.Print Stmt right after all the concatenation, the last From clause is missing?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Interesting...I had the watch defined for another reason and noticed Stmt not being built correctly. Or so I thought. At your suggestion I let the code continue and even though the value in the watch did not show the full value of Stmt the string had been built correctly (the SQL statement returned the correct records).

Maybe the watch only shows the first x number of characters in the value column.

Anyway, thanks for your help. Sometimes just a second set of eyes can make all the difference.

Thanks,

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top