www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Error help

Hybrid View

  1. #1
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138

    Error help

    my site has been working perfectly until now....now when you go to the comments page you get the following error:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

    /martzblog/blog/shared/connect_com.inc, line 15
    on connect_com.inc I have:
    Code:
    <%
    Dim objDC,rs,rs1,objDC1,i,username
    
    ' Create and establish data connection
    Set objDC = Server.CreateObject("ADODB.Connection")
    objDC.ConnectionTimeout = 15
    objDC.CommandTimeout = 30
    
    'Use this line to use Access
    objDC.Open "DBQ=" & Server.MapPath("blog.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;MaxBufferSize=8192;Threads=20;", "UID", "PASSWORD"
    
    ' Create recordset and retrieve values using the open connection
    
    set rs = Server.createObject("ADODB.Recordset")
    rs.Open "SELECT * FROM blog WHERE id = " & Replace(Request.QueryString("id"), "'", "''"), objDC, 3
    
    set rs1 = Server.createObject("ADODB.Recordset")
    rs1.Open "SELECT * FROM comments WHERE num = " & Replace(Request.QueryString("id"), "'", "''"), objDC, 3
    
    %>
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  2. #2
    Join Date
    Feb 2003
    Posts
    2,745
    Check the value of:

    Replace(Request.QueryString("id"), "'", "''")

  3. #3
    Join Date
    Feb 2003
    Posts
    2,745
    Also, you should never use a .inc extension for an include file, particualrly if it contains sensitive information like a connection string (as yours does). Should change to .asp An inc file can be downloaded directly in a web browser. Easiest hack there is.

  4. #4
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    this opens and gives the error the first time, but when you refresh it works fine....any ideas?
    i am requesting a number from the url if this helps any...like index.asp?id=2
    Last edited by sirhcchris3; 11-05-2004 at 07:05 PM.
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  5. #5
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    i am requesting a number from the url if this helps any...like index.asp?id=2
    We know

    This error means that your QueryString variable is infact empty (like Russell said). Its strange that it only works when you refresh the page.

    Which page is this file included into?

  6. #6
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    it does it on my comments.asp page http://m.1asphost.com/martzblog/blog/comments.asp?id=3 now that I have changed this file to a .asp file instead of .inc...it seems to be working okay...why would this be?
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  7. #7
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    I take that back, I now am getting the error again! what is wrong?
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  8. #8
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    http://m.1asphost.com/martzblog/blog/comments.asp?id=10 gives this error again, when i refresh it works fine. I use the same connection as another page and that page doesn't have this problem. Any ideas?
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  9. #9
    Join Date
    Feb 2003
    Posts
    2,745
    Works ok for me. Would need to see more code to tell you for sure what is wrong, but a good start would be
    Code:
    
    If len(Request.QueryString("id")) Then
    
       set rs = Server.createObject("ADODB.Recordset")
       rs.Open "SELECT * FROM blog WHERE id = " & Replace(Request.QueryString("id"), "'", "''"), objDC, 3
    
       set rs1 = Server.createObject("ADODB.Recordset")
       rs1.Open "SELECT * FROM comments WHERE num = " & Replace(Request.QueryString("id"), "'", "''"), objDC, 3
    
    End If
    

  10. #10
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    i supose this could be a server error?
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  11. #11
    Join Date
    Feb 2003
    Posts
    2,745
    Could be. Do you have access to the IIS logs? IT would be interesting to see if all of the errors come from the same user agent, or remote ip.

    Also possible that you have a stale page cached? Maybe try adding:

    Response.ExpiresAbsolute = Date() - 1

    To the top of your asp file.

    Did you check for the existence of the querystring value, as in my last post (red part)? At least that will prevent you from executing the query without the parameter being passed.

  12. #12
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    why won't this work:
    Code:
    response.write("<channel rdf:about="http://m.1asphost.com/martzblog/">")
    and how can i fix it.....I have to have all the quotes that are there....just i get an error when i use them
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  13. #13
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    You cant just terminate a string and expect it to keep working.
    Code:
    response.write("<channel rdf:about=""http://m.1asphost.com/martzblog/"">")
    Escape the quotes.

    Regards.

  14. #14
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    ah yes....thanks a bunch buntine! have you seen my site lately...i have added a rss feed and am working on a atom feed
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

  15. #15
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    got another one....i tried many ways with the quotes but i can't get the correct way
    Code:
    response.write("<item rdf:about=""http://m.1asphost.com/martzblog/blog/comments.asp?id="& rs("ID") & "">")
    Chris.Martz.me
    Some things Man was never meant to know. For everything else, there's Google.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles