Results 1 to 4 of 4

Thread: Pound Sign in SQL statement?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    Pound Sign in SQL statement?

    hello there,

    On my database I have a '#' sign in the field name. How can I pass an SQL statement to an adodc object with a pound sign in the field name.

    Here is my code
    Adodc1.RecordSource = "SELECT DISTINCT Route# FROM dbo_Master"
    Adodc1.Refresh

    I have also tried:
    Adodc1.RecordSource = "SELECT DISTINCT Route'#'....

    as well as:
    Adodc1.RecordSource = "SELECT DISTINCT Route" & "#" ...

    if you have an answer i would really appreciate it. Thank you.

    -Jason

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Brackets... anytime there's a space or a non-alphanumeric in a field/table name, use brackets...
    Code:
    SELECT DISTINCT [Route#] FROM dbo_Master
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54
    Thanks alot, worked like a charm.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Glad to hear it. Could you put RESOLVED into the thread subject (edit the first post, then change the subject line) so that someone else who has the same prob knows they can find a solution here.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width