ASP & Access2k question

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default ASP & Access2k question



    Running asp pages against an Access 2k database.

    2 questions for those vastly more knowledgeable than myself.

    - Are wildcards allowed in Access 2k SQL statements? If so, what are
    they, and what, if anything, do I need to be aware of programmatically
    in ASP?

    - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
    is the correct syntax both within the database directly and is ASP?

    Thanks.

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Micromanaged Guest

  2. Similar Questions and Discussions

    1. Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you
      <[email protected]> wrote in message news:[email protected].. This is the most important question of...
    2. newB question: related tables question
      hello i have a data base with 10 tables, i want to automaticaly creat a row in all of the tables wehen i create in the first one. normal table...
  3. #2

    Default Re: ASP & Access2k question

    a) Yes you can use wildcards. For OLEDB Provider, you use standard ANSI SQL
    wildcards.

    b) Yes, you can use LIKE

    [url]www.adopenstatic.com/faq/likequeries.asp[/url]

    Cheers
    Ken


    "Micromanaged" <[email protected]> wrote in message
    news:ucb4$[email protected]..
    >
    >
    > Running asp pages against an Access 2k database.
    >
    > 2 questions for those vastly more knowledgeable than myself.
    >
    > - Are wildcards allowed in Access 2k SQL statements? If so, what are
    > they, and what, if anything, do I need to be aware of programmatically
    > in ASP?
    >
    > - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
    > is the correct syntax both within the database directly and is ASP?
    >
    > Thanks.

    Ken Schaefer Guest

  4. #3

    Default Re: ASP & Access2k question


    "Micromanaged" <[email protected]> wrote in message
    news:ucb4$[email protected]..
    > - Are wildcards allowed in Access 2k SQL statements? If so, what are
    > they, and what, if anything, do I need to be aware of programmatically
    > in ASP?
    >
    > - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
    > is the correct syntax both within the database directly and is ASP?
    >


    Select * from myTable where FIELD like "%text%"


    HTH,
    PW



    PW Guest

  5. #4

    Default Re: ASP & Access2k question

    <<
    - Are wildcards allowed in Access 2k SQL statements? If so, what are
    they, and what, if anything, do I need to be aware of programmatically
    in ASP?

    - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
    is the correct syntax both within the database directly and is ASP?
    >>
    Like Options:

    All except blanks:
    Like '%'

    Starting with A:
    Like 'A%'
    Or could do this: Like 'a%'

    A somewhere in the field:
    Like '%A%'
    Or could do this: Like '%a%'

    One character an A or B or D:
    Like '[A,B,D]'
    Or could do this: Like '[a,b,d]'

    One character A through C as the first character:
    Like '[A-C]%'
    Or could do this: Like '[a-c]%'

    A through C as the 1st character and A through H as the 2nd character:
    Like '[A-C][A-H]%'
    Or could do this: Like '[a-c][a-h]%'

    Starting with Sm, ending with th, and anything for the 3rd character:
    Like 'SM?TH'
    Or could do this: Like 'sm?th'

    Digit for the 1st character:
    Like '#%'
    Or could do this: Like '[0-9]%'

    Not in a range of letters:
    Like '[!a-c]'

    Not start with a range of letters:
    Like '[!a-c]%'

    Not start with a number:
    Or could do this: Like '[!0-9]%'

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    [url]http://www.Bullschmidt.com[/url]
    Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt Guest

  6. #5

    Default Re: ASP & Access2k question

    On Wed, 28 Jul 2004 09:31:33 +0800, "PW" <[email protected]>
    wrote:
    >
    >"Micromanaged" <[email protected]> wrote in message
    >news:ucb4$[email protected]..
    >> - Are wildcards allowed in Access 2k SQL statements? If so, what are
    >> they, and what, if anything, do I need to be aware of programmatically
    >> in ASP?
    >>
    >> - Can I use the 'LIKE' keyword in Access 2k SQL statements? If so, what
    >> is the correct syntax both within the database directly and is ASP?
    >>
    >
    >
    >
    >Select * from myTable where FIELD like "%text%"
    >
    I wouldn't recommend using the "Select * from " - Name the columns
    you want including in the result. By putting a * your making the DB
    engine work harder, (just to save you some typing) First the engine
    has to find out what columns are in a table then get the info. If you
    tell it what columns you want this has 2 advantages.

    1) The engine knows the columns so can just return the info
    2) it will help you later on (or other coders) when you relook at your
    code.

    HTH

    Al.


    Harag Guest

  7. #6

    Default Re: ASP & Access2k question

    > Select * from myTable where FIELD like "%text%"

    Use ' not " for delimiting the string inside the SQL statement.

    And don't use SELECT *

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)


    Aaron [SQL Server MVP] Guest

  8. #7

    Default Re: ASP & Access2k question



    This is the error I get when I enter a% on the asp page:

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
    operator) in query expression '(CompanyName LIKE 'a%' ORDER BY
    CompanyName'.
    /lioa/srchrslts.asp, line 127

    This is the code involved:

    Dim objConn
    Set objConn=Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & DBPath

    objConn.Open
    Dim strSQL

    If rsrch="CompanyName" Then
    strSQL="SELECT Distinct CompanyName, AddressLine1, AddressLine2,
    AddressLine3, " & _
    "City, State, Zip, Country FROM Customers " & _
    "WHERE (CompanyName LIKE '" & rcrtra & "' " & _
    "ORDER BY CompanyName"
    End If

    Response.Write("<tr><td>" & objRS.Fields.Item(0).Value & "</td><td>" &
    objRS.Fields.Item(1) & "</td><td>" & objRS.Fields.Item(2) & "</td><td>"
    & objRS.Fields.Item(3) & "</td><td>" & objRS.Fields.Item(4) &
    "</td></tr>")
    objRS.MoveNext

    Set objRS=Nothing
    objConn.Close
    Set objConn=Nothing

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Micromanaged Guest

  9. #8

    Default Re: ASP & Access2k question

    Well, you have an opening ( but not a closing ) ...

    You probably could have caught this yourself, using:

    Response.Write StrSQL

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Micromanaged" <[email protected]> wrote in message
    news:ey$[email protected]..
    >
    >
    > This is the error I get when I enter a% on the asp page:
    >
    > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    > [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
    > operator) in query expression '(CompanyName LIKE 'a%' ORDER BY
    > CompanyName'.
    > /lioa/srchrslts.asp, line 127
    >
    > This is the code involved:
    >
    > Dim objConn
    > Set objConn=Server.CreateObject("ADODB.Connection")
    > objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
    > "DBQ=" & DBPath
    >
    > objConn.Open
    > Dim strSQL
    >
    > If rsrch="CompanyName" Then
    > strSQL="SELECT Distinct CompanyName, AddressLine1, AddressLine2,
    > AddressLine3, " & _
    > "City, State, Zip, Country FROM Customers " & _
    > "WHERE (CompanyName LIKE '" & rcrtra & "' " & _
    > "ORDER BY CompanyName"
    > End If
    >
    > Response.Write("<tr><td>" & objRS.Fields.Item(0).Value & "</td><td>" &
    > objRS.Fields.Item(1) & "</td><td>" & objRS.Fields.Item(2) & "</td><td>"
    > & objRS.Fields.Item(3) & "</td><td>" & objRS.Fields.Item(4) &
    > "</td></tr>")
    > objRS.MoveNext
    >
    > Set objRS=Nothing
    > objConn.Close
    > Set objConn=Nothing
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Aaron [SQL Server MVP] Guest

  10. #9

    Default Re: ASP & Access2k question



    That did the trick. I ran a response.write and noticed that I neglected
    to put a closing ) on my SQL statement. Corrected that, and life works
    now.

    Thanks for the assistance.


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Micromanaged Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139