SQL "Where" Problem in ASP

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

  1. #1

    Default SQL "Where" Problem in ASP

    Hi

    I just noticed this on my site the other day and its driving my crazy trying
    to fix it. The ASP pages connect to a ACCESS database and attempt to get
    records using sample code like the one below. Since January this has
    worked without any issues (and continues to work on my test server) however
    it no longer works on the live server, the only updates i have done are the
    windows ones and these are the only changes that have been made to the
    server.


    This code works on test but not on the live server (both are using win 2000
    server)

    Set adoCon = Server.CreateObject("ADODB.Connection")
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
    Server.MapPath("spirit.mdb")
    Set rsDatabase = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM Characters WHERE Server = 'test'"
    rsDatabase.Open strSQL, adoCon

    If i change the code to the following then the code works correctly but i
    need the WHERE statement to select the correct records.

    Set adoCon = Server.CreateObject("ADODB.Connection")
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
    Server.MapPath("spirit.mdb")
    Set rsDatabase = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM Characters"
    rsDatabase.Open strSQL, adoCon

    The error message i get back using the first example is, which off course
    dosent help at all
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] Unknown
    /testdb.asp, line 7

    I have tried the following on the live server.
    1. Reinstall MDAC 2.8
    2. Reinstall Service Pack 4
    3. Remove/Reinstall IIS
    4. Reinstall Jet Service Pack 8

    none of these fix it, can anybody give me any clues as to where to look? I
    cant reinstall the OS!



    Toytown Guest

  2. Similar Questions and Discussions

    1. Proj cannot run on LCDS 2.6 ES due to "Unable to resolveresource bundle "datamanagement" for locale "en_US"
      hi, all, We have developped an application on Flex Build 3 (run successfully), but failed when we try to deploy it on Tomcat with LCDS 2.5 ES...
    2. Drag and drop problem with "dragEnabled" and"allowMultipleSelection"
      Update 2, if it can help someone: Finally I don't manage the drag and drop by myself using DragManager.doDrag(...). Why? Because doing so if the...
    3. CFINPUT type="radio" w/ "value" requires "label"
      On a Flash form, when you specify type='radio' and value='whatever', the value of the 'value' attribute will be displayed as a label if no 'label'...
    4. Problem with fopen("php://input", "r")
      Hello there, I am having problem opening the in-built php stream php://input According to the manual this has been integrated into php since...
    5. "Start" "Program" "Menu" list is empty
      For what ever reason my list of installed programs in my "Start" "Programs" menu is empty. Anyone know how to restore the list. Thanks for your...
  3. #2

    Default Re: SQL "Where" Problem in ASP

    How about:

    db = Server.MapPath("spirit.mdb")
    Set adoCon = CreateObject("ADODB.Connection")
    adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db
    strSQL = "SELECT * FROM Characters WHERE Server = 'test'"
    Set rsDatabase = adoCon.Execute(strSQL)

    Changes:

    (a) avoiding an explicit ADODB.Recordset when unwarranted
    [url]http://www.aspfaq.com/2191[/url]

    (b) avoiding ODBC/DSN
    [url]http://www.aspfaq.com/2126[/url]

    Recommended further change: stop using SELECT *!
    [url]http://www.aspfaq.com/2096[/url]

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




    "Toytown" <teh-billy@microsoft.com> wrote in message
    news:_eAIc.26689$xi3.12320@fe18.usenetserver.com.. .
    > Hi
    >
    > I just noticed this on my site the other day and its driving my crazy
    trying
    > to fix it. The ASP pages connect to a ACCESS database and attempt to get
    > records using sample code like the one below. Since January this has
    > worked without any issues (and continues to work on my test server)
    however
    > it no longer works on the live server, the only updates i have done are
    the
    > windows ones and these are the only changes that have been made to the
    > server.
    >
    >
    > This code works on test but not on the live server (both are using win
    2000
    > server)
    >
    > Set adoCon = Server.CreateObject("ADODB.Connection")
    > adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
    > Server.MapPath("spirit.mdb")
    > Set rsDatabase = Server.CreateObject("ADODB.Recordset")
    > strSQL = "SELECT * FROM Characters WHERE Server = 'test'"
    > rsDatabase.Open strSQL, adoCon
    >
    > If i change the code to the following then the code works correctly but i
    > need the WHERE statement to select the correct records.
    >
    > Set adoCon = Server.CreateObject("ADODB.Connection")
    > adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
    > Server.MapPath("spirit.mdb")
    > Set rsDatabase = Server.CreateObject("ADODB.Recordset")
    > strSQL = "SELECT * FROM Characters"
    > rsDatabase.Open strSQL, adoCon
    >
    > The error message i get back using the first example is, which off course
    > dosent help at all
    > Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    > [Microsoft][ODBC Microsoft Access Driver] Unknown
    > /testdb.asp, line 7
    >
    > I have tried the following on the live server.
    > 1. Reinstall MDAC 2.8
    > 2. Reinstall Service Pack 4
    > 3. Remove/Reinstall IIS
    > 4. Reinstall Jet Service Pack 8
    >
    > none of these fix it, can anybody give me any clues as to where to look?
    I
    > cant reinstall the OS!
    >
    >
    >

    Aaron [SQL Server MVP] Guest

  4. #3

    Default Re: SQL "Where" Problem in ASP

    Toytown wrote:
    > strSQL = "SELECT * FROM Characters WHERE Server = 'test'"
    > rsDatabase.Open strSQL, adoCon
    I can't find the word in any of the lists I have, but from the symptoms, I
    suspect "Server" may be a reserved keyword. In addition to the changes Aaron
    recommended, I suggest surrounding the word with brackets:

    " ... [Server] = 'test'"

    HTH,
    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  5. #4

    Default Re: SQL "Where" Problem in ASP

    > I suggest surrounding the word with brackets:

    Or renaming the column. ;-)

    A


    Aaron [SQL Server MVP] Guest

  6. #5

    Default Re: SQL "Where" Problem in ASP

    Just to let you know, im going to make the changes identified above and see
    if they fix it, but also that any of the fields (server etc) will cause the
    same issue.

    Also why does this still work on one system and not another?
    And why would one stop working, unless one of the updates screwed it?


    "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
    news:OzmQxKEaEHA.2520@TK2MSFTNGP12.phx.gbl...
    > > I suggest surrounding the word with brackets:
    >
    > Or renaming the column. ;-)
    >
    > A
    >
    >


    Toytown Guest

  7. #6

    Default Re: SQL "Where" Problem in ASP


    "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
    news:uC6ihzDaEHA.2944@TK2MSFTNGP11.phx.gbl...
    > How about:
    >
    > db = Server.MapPath("spirit.mdb")
    > Set adoCon = CreateObject("ADODB.Connection")
    > adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db
    > strSQL = "SELECT * FROM Characters WHERE Server = 'test'"
    > Set rsDatabase = adoCon.Execute(strSQL)
    >

    I get exactly the same error :( using the above code, im sure the server is
    screwed somehow, but is there any idea of how i can get it working
    again?even if i use a different database or field name (server) i still get
    the same problem. I really appreciate the help BTW.

    Microsoft JET Database Engine error '80040e14'

    Unknown

    /testdb2.asp, line 6



    Toytown Guest

  8. #7

    Default Re: SQL "Where" Problem in ASP

    > Also why does this still work on one system and not another?
    > And why would one stop working, unless one of the updates screwed it?
    Probably because one of the updates "screwed it"... what updates are you
    talking about, btw?

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


    Aaron [SQL Server MVP] Guest

  9. #8

    Default Re: SQL "Where" Problem in ASP

    The only updates to the server before it stopped working were the typical
    windows ones, through windows update. The ones i remember off hand were
    the JET update and the ADODB stream problem update. Like my previous
    message even using your sample code didnt work......however it works on my
    other system........any other clues before i give up on it. Again it works
    until i enter the WHERE part of the SQL string and then it gives up :(

    Thanx for all your help!!


    "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
    news:OQKQpdEaEHA.2016@TK2MSFTNGP09.phx.gbl...
    > > Also why does this still work on one system and not another?
    > > And why would one stop working, unless one of the updates screwed it?
    >
    > Probably because one of the updates "screwed it"... what updates are you
    > talking about, btw?
    >
    > --
    > [url]http://www.aspfaq.com/[/url]
    > (Reverse address to reply.)
    >
    >


    Toytown Guest

Posting Permissions

  • You may not post new threads
  • You may 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