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
%>
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.
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.
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
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.
Bookmarks