Anybody used to .NET here? Spooky problem.

amazingtrade

Mad Madchestoh fan
Joined
Jun 19, 2003
Messages
5,139
Reaction score
0
Location
Manchester
In VB.NET I am trying to get these page working. It keeps coming up with

: BC30205: End of statement expected.

The spooky thing is that the same routine everywhere else in the code works, but when it comes to using the variable name HDS it comes displays the error message. The SQL statement is shown below.

mysql2= "SELECT * FROM project_hd where id="&hds

if I swap hds to a variable I coded on the first day of programming it such as USBID it works fine, but if I try and change the name it dosn't work even though I have changed the variable name everytime it appears in the code, thus the variable is doing exactly the same thing.

There does not seem to be any logical reason for this, does anybody have an idea what I can do to solve it? This is really doing my head in.

Thanks.
 
I don't know .NET, but from the syntax you have above it would appear that the ampersand is a concatenation character -- is that correct? If not and the amersand is indicates a replacement variable, then should the &hds be inside the quotes -- that would tend to be consistent with the error message as well.
 
I just did a quick bit of research, and it seems that the ampersand character indicates concatenation. Guess that idea was no help.

Here's some other ideas (disclaimer, these may all be irrelevant -- I don't know .NET):

Some compilers actually complain about an error on the line after the actual problem -- could that be the case?

Always test with the simplest case. Declare/initialize a brand new variable and use that *only* in this line. If that works, then it indicates you're doing something wrong with hds, or in changing USBID incorrectly when you use that one.

One other thing you could try... try some Mana under it :)
 
Don't know .NET but in VB you would need a space between the & and hds otherwise the system thinks there is a variable named &hds
 
That was the only variable name, I changed HDS to many things as well, I tried that space thing and it didn;t work. In the end I decided it probably one of them Microsoft bugs, (there is somthing very similar with I.E and CSS and it took my boss an entire day to fix it only realise there was nothing wrong with is code, but with I.E).

I have totally recoded it now but split up into two parts by using user controls, it works perfectly now. What I have now done is also more sophicated than my drafts.
 
I doubt it was a bug AT. It was most likely some very subtle aspect of syntax or similar issue that was catching you out. I have had similar problems with C++ and, to a lesser extent, Java and I've always eventually discovered where I was going wrong.

Michael.
 
Back
Top