Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / July 2004



Tip: Looking for answers? Try searching our database.

large variable in VB6

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LemonJello - 24 Jul 2004 21:09 GMT
I have a function that accepts as one of its parameters, a string
variable.  The string variable is a connection string (which as you
can imagine, connection strings can be very long).  Anyhow, the
connection string is over 300 chars long but get truncated at about
250 chars.  Is there a way to set the variable such that it can hold
and pass a 300 char string?

I've tried:
Dim ConnStr as String * 300

but still doesn't work.  Is there a llimit in VB6 of 250 chars for a
string variable?  I don't think there is such a limit for VB.NET but
I've got to develop in VB6.

Thanks in advance.
Mike Williams - 24 Jul 2004 21:31 GMT
> . . . anyhow, the connection string is over 300 chars long but
> get truncated at about 250 chars.  Is there a way to set the
> variable such that it can hold and pass a 300 char string?
> I've tried:
> Dim ConnStr as String * 300
> but still doesn't work.  Is there a llimit in VB6 of 250 chars

In VB6 a variable length string can hold up to about 2 billion (2 ^ 31)
characters, subject to memory availability. Fixed length strings can hold up
to about 64K (2 ^ 16) characters. In both cases each character can be
anything at all, including all sorts of controls characters. How are you
getting the data into the string? And how are you dealing with the string
data once you have got it? Post your code.

Mike
Marv Wade - 24 Jul 2004 21:32 GMT
This works for me

Dim TestString As String * 350
TestSting = String(349, "A") & String("1", "B")
debugprint TestString

Marv

> I have a function that accepts as one of its parameters, a string
> variable.  The string variable is a connection string (which as you
[quoted text clipped - 11 lines]
>
> Thanks in advance.
Mike Williams - 24 Jul 2004 21:50 GMT
> Anyhow, the connection string is over 300 chars long but
> get truncated at about 250 chars . . .

I'll wait for your response to my earlier message asking for details of your
code, but just as an afterthought you wouldn't happen to be getting the
string using the Input statement or something similar would you?

Mike
preben nielsen - 25 Jul 2004 16:28 GMT
> I'll wait for your response to my earlier message asking for details of your
> code, but just as an afterthought you wouldn't happen to be getting the
> string using the Input statement or something similar would you?

Line Input statement gladly accepts strings well over 100KB !
Believe me...... :)

Signature

/\ preben nielsen
\/\ prel@post.tele.dk

Mike Williams - 25 Jul 2004 17:34 GMT
>Line Input statement gladly accepts strings well
> over 100KB ! Believe me...... :)

I don't think you understand what I am getting at, Preben. Try this:

Dim s1 As String
s1 = "So how long is this line?"
Mid$(s1, 5) = Chr$(26)
Open "c:\test1" For Output As 1
Print #1, s1
Close 1
Print Len(s1)
Open "c:\test1" For Input As 1
Print LOF(1)
Line Input #1, s1
Close 1
Print Len(s1)

Mike
LemonJello - 26 Jul 2004 07:40 GMT
> > Anyhow, the connection string is over 300 chars long but
> > get truncated at about 250 chars . . .
[quoted text clipped - 4 lines]
>
> Mike

Mike,  below is the code that's a problem:

 sjarPM(0) = "datagridmanager\EpicJava.jar;"
 sjarPM(1) = "xml-apis.jar;"
 sjarPM(2) = "xercesImpl.jar;"
 sjarPM(3) = "DiscoveryGateClient.jar;"
 sjarPM(4) = "csinline.jar;"
 sjarPM(5) = "log4j.jar;"
 sjarPM(6) = "datagridmanager\RegistrationLite.jar;"
 NjarPM = 6

 sDiscoveryGateClientHome = "C:\ads\ADSClient1.1"

 slib = sDiscoveryGateClientHome & "\lib\"
 sJavaClassPath = "-Djava.class.path="
 For i = 0 To NjarPM
   sJavaClassPath = sJavaClassPath & slib & sjarPM(i)
 Next i

Call DataGridServer.LoadJVM(sJvmPath, sJavaClassPath,
sDiscoveryGateClientHomeParam, sPolicy, "")

The variable in question is cJavaClassPath which is contatenated to
become a really big string (~300 chars) but it keeps getting truncated
at about 250 chars (according to the watch list in Visual Sutdio.  Is
there a way that I can declare sJavaClassPath such that it can retain
all the contatenations as it is passed to DataGridServer.LoadJVM?

Thanks
Don@home.com - 26 Jul 2004 08:14 GMT
>  sjarPM(0) = "datagridmanager\EpicJava.jar;"
>  sjarPM(1) = "xml-apis.jar;"
[quoted text clipped - 15 lines]
>Call DataGridServer.LoadJVM(sJvmPath, sJavaClassPath,
>sDiscoveryGateClientHomeParam, sPolicy, "")

See comments after Print Len(.....

Option Explicit

Private Sub Form_Click()
Dim sjarPM(6) As String
Dim sDiscoveryGateClientHome As String
Dim slib As String
Dim sJavaClassPath As String
Dim NjarPM As Long
Dim i As Long

 sjarPM(0) = "datagridmanager\EpicJava.jar;"
 sjarPM(1) = "xml-apis.jar;"
 sjarPM(2) = "xercesImpl.jar;"
 sjarPM(3) = "DiscoveryGateClient.jar;"
 sjarPM(4) = "csinline.jar;"
 sjarPM(5) = "log4j.jar;"
 sjarPM(6) = "datagridmanager\RegistrationLite.jar;"
 NjarPM = 6

 sDiscoveryGateClientHome = "C:\ads\ADSClient1.1"

 slib = sDiscoveryGateClientHome & "\lib\"
 sJavaClassPath = "-Djava.class.path="
 For i = 0 To NjarPM
   sJavaClassPath = sJavaClassPath & slib & sjarPM(i)
 Next i
Print Len(sJavaClassPath) 'Prints 327 on my system
 For i = 0 To NjarPM
   sJavaClassPath = sJavaClassPath & slib & sjarPM(i)
 Next i
Print Len(sJavaClassPath) 'Prints 636 on my system
 For i = 0 To NjarPM
   sJavaClassPath = sJavaClassPath & slib & sjarPM(i)
 Next i
Print Len(sJavaClassPath) 'Prints 945 on my system
 For i = 0 To NjarPM
   sJavaClassPath = sJavaClassPath & slib & sjarPM(i)
 Next i
Print Len(sJavaClassPath) 'Prints 1254 on my system

'Call DataGridServer.LoadJVM(sJvmPath, sJavaClassPath, _
           sDiscoveryGateClientHomeParam, sPolicy, "")
End Sub

Have a good day...

Don
Jan Hyde - 26 Jul 2004 09:11 GMT
raoulyserman@yahoo.com (LemonJello)'s wild thoughts were
released on 25 Jul 2004 23:40:50 -0700 bearing the following
fruit:

>> > Anyhow, the connection string is over 300 chars long but
>> > get truncated at about 250 chars . . .
[quoted text clipped - 30 lines]
>become a really big string (~300 chars) but it keeps getting truncated
>at about 250 chars (according to the watch list in Visual Sutdio.

The watch window may well trim the output to 250 chars but
it doesn't mean the variables contents has been trimmed.
What do you get if you do a LEN on your variable

J

>Is
>there a way that I can declare sJavaClassPath such that it can retain
>all the contatenations as it is passed to DataGridServer.LoadJVM?
>
>Thanks

Jan Hyde

Signature

Sign on the petshop window.- "Every customer receives a free legless
parakeet. No perches necessary"

(Gary Hallock)

[Abolish the TV License - http://www.tvlicensing.biz/]

Jeff Johnson [MVP:VB] - 26 Jul 2004 05:55 GMT
>I have a function that accepts as one of its parameters, a string
> variable.  The string variable is a connection string (which as you
[quoted text clipped - 7 lines]
>
> but still doesn't work.

As others have said: post code.

One question: have you verified that your variable definitely contains the
full string before the function is called?

> Is there a llimit in VB6 of 250 chars for a
> string variable?

250, no. Something in your code is truncating this string. When you find it,
you'll do one of two things:

A) If the code is yours, you'll smack your forehead and say "Dammit, I
forgot about that," or

B) If it's code from someone else (or built-in to VB), you'll say "Why the
hell did they do that?"
LemonJello - 30 Jul 2004 19:47 GMT
Yup, you're right.  When I tried to debug using a msgbox to see what
string is actually, passed, it was indeed the correct full strong
value, so my problem appears to be elsewhere in the code.  I've since
found ths problem and fixed it.  Thanks to all who responded!

> >I have a function that accepts as one of its parameters, a string
> > variable.  The string variable is a connection string (which as you
[quoted text clipped - 24 lines]
> B) If it's code from someone else (or built-in to VB), you'll say "Why the
> hell did they do that?"
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.