CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: simple as pie!

  1. #1
    Join Date
    Aug 2006
    Posts
    65

    simple as pie!

    dont suppose any1 can tell me whats wrong with thissyntax)

    cSQL = "SELECT PERSNO FROM PERSON WHERE PERSNO LIKE" & Quote(Request("SOURCE"))%

    thanks

  2. #2
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    Re: simple as pie!

    Have you tried this?

    cSQL = "SELECT PERSNO FROM PERSON WHERE PERSNO LIKE" & Quote(Request("SOURCE")) & "%"

    or

    cSQL = "SELECT PERSNO FROM PERSON WHERE PERSNO LIKE @SOURCE"

    and add a parameter into your command object i.e
    dbComm.Parameters.Add(New SqlParameter("@SOURCE", Quote(Request("SOURCE")))
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  3. #3
    Join Date
    Sep 2002
    Location
    England
    Posts
    530

    Re: simple as pie!

    A space between the LIKE and the " will be needed (I think?).

    Can't comment on the rest of the query though...

  4. #4
    Join Date
    Feb 2006
    Posts
    31

    Thumbs up Re: simple as pie!

    cSQL = "SELECT PERSNO FROM PERSON WHERE PERSNO LIKE '" & Quote(Request("SOURCE")) & "%'"

    i think so Single quotes missing

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

Featured