Jump to content

AJAX database example tutorial


coder

Recommended Posts

Hello:I'm learning AJAX for the first time. I have Windows 2000 Professional OS on my machine. I activate the IIS server when I want to practice ASP. I have been trying to get the same results as at this page:http://www.w3schools.com/ajax/ajax_database.aspI've copied/pasted the corresponding scripts into their appropriate files.I copied the Northwind.mdb Access database to a directory (db) within my localhost's site.This is the area where there seems to be a problem:----------------- code -----------------<%sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID="sql=sql & request.querystring("q")set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/db/northwind.mdb"))set rs = Server.CreateObject("ADODB.recordset")rs.Open sql, connresponse.write("<table>")do until rs.EOFfor each x in rs.Fieldsresponse.write("<tr><td><b>" & x.name & "</b></td>")response.write("<td>" & x.value & "</td></tr>")nextrs.MoveNextloopresponse.write("</table>")%>And this is the ERROR MESSAGE I'm currently getting:--------------------- ERROR MESSAGE TEXT (abbreviated) -------------------The page cannot be displayed • • • HTTP 500.100 - Internal Server Error - ASP errorInternet Information ServicesTechnical Information (for support personnel) * Error Type: Microsoft JET Database Engine (0x80040E10) No value given for one or more required parameters. /ajax/getcustomer.asp, line 22 • • • (etc., etc.)-------------------------------------------------------------------------------------------------I appreciate any help, hopefully from the site admin who wrote this script, or anyone on this forum.Thanks.Luis

Link to comment
Share on other sites

Guest Rikardo
----------------- code -----------------<%sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID="sql=sql & request.querystring("q")set conn=Server.CreateObject("ADODB.Connection")
I changed the:sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID="sql=sql & request.querystring("q")to:sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID='"sql=sql & request.querystring("q") & "'"It then worked. I think it is because 'q' is a string not an integer.
Link to comment
Share on other sites

I changed the:sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID="sql=sql & request.querystring("q")to:sql="SELECT * FROM CUSTOMERS WHERE CUSTOMERID='"sql=sql & request.querystring("q") & "'"It then worked. I think it is because 'q' is a string not an integer.
Rikardo:I just tested it with new 'sql' corrected statement and it worked.I like this "AJAX" feature that I never noticedmuch, before.Thanks very much.Luis
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...