Anybody used to .NET here? Spooky problem.

Discussion in 'General Chat' started by amazingtrade, Jan 27, 2005.

  1. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    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.
     
    amazingtrade, Jan 27, 2005
    #1
  2. amazingtrade

    Nepherim Deep Purple Flactulence

    Joined:
    Jun 20, 2003
    Messages:
    131
    Likes Received:
    0
    Location:
    NJ, USA
    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.
     
    Nepherim, Jan 28, 2005
    #2
  3. amazingtrade

    Nepherim Deep Purple Flactulence

    Joined:
    Jun 20, 2003
    Messages:
    131
    Likes Received:
    0
    Location:
    NJ, USA
    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 :)
     
    Nepherim, Jan 28, 2005
    #3
  4. amazingtrade

    LiloLee Blah, Blah, Blah.........

    Joined:
    Jun 20, 2003
    Messages:
    789
    Likes Received:
    0
    Location:
    Maidenhead, Berkshire
    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
     
    LiloLee, Jan 28, 2005
    #4
  5. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    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.
     
    amazingtrade, Jan 28, 2005
    #5
  6. amazingtrade

    michaelab desafinado

    Joined:
    Jun 19, 2003
    Messages:
    6,403
    Likes Received:
    1
    Location:
    Lisbon, Portugal
    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.
     
    michaelab, Jan 28, 2005
    #6
  7. amazingtrade

    LiloLee Blah, Blah, Blah.........

    Joined:
    Jun 20, 2003
    Messages:
    789
    Likes Received:
    0
    Location:
    Maidenhead, Berkshire
    Coding can be fun, but my head also hurts when I keep hitting it against a brickwall.
     
    LiloLee, Jan 28, 2005
    #7
  8. amazingtrade

    amazingtrade Mad Madchestoh fan

    Joined:
    Jun 19, 2003
    Messages:
    5,139
    Likes Received:
    0
    Location:
    Manchester
    Glad to see I am not the only person who has this problem then.
     
    amazingtrade, Jan 29, 2005
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...