bruce
04-03-2003, 02:24 AM
I get an error message saying the following. If you have not already done so, turn off friendly http error on your browser if you are using IE. Tools -> Options -> Advance Tab -> Uncheck Show friendly http error message.
Microsoft VBScript compilation error '800a03ea'
Syntax error
/demo_update.asp, line 23
else
^
[b]quote:Originally posted by gasounet000
I use a page named "UpdateTable2.asp" used to display a set of records from an Access Dbase. The file works fine displaying each customers ID, Last Name, First Name, and Last 4 of SS. The attribute button "Custid", when clicked, should allow the user to update a record by calling a file named "demo_update.asp"
Unfortunately, when the "Custid" button is clicked in the "UpDateTable2.asp" page, the next page reads "The Page Cannot Be Displayed." There seems to be a problem in the "demo_update.asp" page and I can't identify it (hours and hours of trial and error).
Can anyone help? The URL is gasou.net/UpdateTable2.asp (http://gasou.net/UpdateTable2.asp)
The code for both pages follows;
****UpDateTable2.asp****
[quote]
<%optionexplicit%>
<html>[b]
<%
dimconn,rs,x
setconn=Server.CreateObject("ADODB.Connection")
conn.open"DSNname"
setrs=Server.CreateObject("ADODB.Recordset")
rs.open"SELECT*FROMcustomers",conn
%>
<tableborder="1"width="100%">
<trbgcolor="#b0c4de">
<%
foreachxinrs.Fields
response.write("<th>"&ucase(x.name)&"</th>")
next
%>
</tr>
<%dountilrs.EOF%>
<trbgcolor="#f0f0f0">
<formmethod="post"action="demo_update.asp">
<%
foreachxinrs.Fields
ifx.name="Custid"then%>
<td><inputtype="submit"name="Custid"value="<%=x.value%>"></td>
<%else%>
<td><%Response.Write(x.value)%></td>
<%endif
next
%>
</form>
<%rs.MoveNext%>
</tr>
<%
loop
rs.close
setrs=nothing
conn.close
setconn=nothing
%>
</table>
</body>
</html>
</CODE>
************************************************** *******************
****demo_update.asp****
[quote]
<html>[b]
<%
setconn=Server.CreateObject("ADODB.Connection")
conn.open"DSNname"
cid=Request.Form("Custid")
setrs=Server.CreateObject("ADODB.Recordset")
rs.open"SELECT*FROMcustomersWHERECustid="&cid,conn
%>
<formmethod="post"action="demo_update.asp">
<table>
<%foreachxinrs.Fields%>
<tr>
<td><%=x.name%></td>
<td><inputname="<%=x.name%>"value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
[b][b]
<inputtype="submit"value="Updaterecord">
</form>
<%
else
sql="UPDATEcustomersSET"
sql=sql&"Custid='"&cid&"',"
sql=sql&"LastName='"&Request.Form("LastName")&"',"
sql=sql&"FirstName='"&Request.Form("FirstName")&"',"
sql=sql&"Last4='"&Request.Form("Last4")&"'"
sql=sql&"WHERECustid="&cid
onerrorresumenext
conn.Executesql
iferr<>0then
response.write("Noupdatepermissions!")
else
response.write("Record"&cid&"wasupdated!")
endif
endif
conn.close
%></body>
</html>
</CODE>
************************************************** ********************
J. Dyer
</blockquote id="quote"></font id="quote">
Microsoft VBScript compilation error '800a03ea'
Syntax error
/demo_update.asp, line 23
else
^
[b]quote:Originally posted by gasounet000
I use a page named "UpdateTable2.asp" used to display a set of records from an Access Dbase. The file works fine displaying each customers ID, Last Name, First Name, and Last 4 of SS. The attribute button "Custid", when clicked, should allow the user to update a record by calling a file named "demo_update.asp"
Unfortunately, when the "Custid" button is clicked in the "UpDateTable2.asp" page, the next page reads "The Page Cannot Be Displayed." There seems to be a problem in the "demo_update.asp" page and I can't identify it (hours and hours of trial and error).
Can anyone help? The URL is gasou.net/UpdateTable2.asp (http://gasou.net/UpdateTable2.asp)
The code for both pages follows;
****UpDateTable2.asp****
[quote]
<%optionexplicit%>
<html>[b]
<%
dimconn,rs,x
setconn=Server.CreateObject("ADODB.Connection")
conn.open"DSNname"
setrs=Server.CreateObject("ADODB.Recordset")
rs.open"SELECT*FROMcustomers",conn
%>
<tableborder="1"width="100%">
<trbgcolor="#b0c4de">
<%
foreachxinrs.Fields
response.write("<th>"&ucase(x.name)&"</th>")
next
%>
</tr>
<%dountilrs.EOF%>
<trbgcolor="#f0f0f0">
<formmethod="post"action="demo_update.asp">
<%
foreachxinrs.Fields
ifx.name="Custid"then%>
<td><inputtype="submit"name="Custid"value="<%=x.value%>"></td>
<%else%>
<td><%Response.Write(x.value)%></td>
<%endif
next
%>
</form>
<%rs.MoveNext%>
</tr>
<%
loop
rs.close
setrs=nothing
conn.close
setconn=nothing
%>
</table>
</body>
</html>
</CODE>
************************************************** *******************
****demo_update.asp****
[quote]
<html>[b]
<%
setconn=Server.CreateObject("ADODB.Connection")
conn.open"DSNname"
cid=Request.Form("Custid")
setrs=Server.CreateObject("ADODB.Recordset")
rs.open"SELECT*FROMcustomersWHERECustid="&cid,conn
%>
<formmethod="post"action="demo_update.asp">
<table>
<%foreachxinrs.Fields%>
<tr>
<td><%=x.name%></td>
<td><inputname="<%=x.name%>"value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
[b][b]
<inputtype="submit"value="Updaterecord">
</form>
<%
else
sql="UPDATEcustomersSET"
sql=sql&"Custid='"&cid&"',"
sql=sql&"LastName='"&Request.Form("LastName")&"',"
sql=sql&"FirstName='"&Request.Form("FirstName")&"',"
sql=sql&"Last4='"&Request.Form("Last4")&"'"
sql=sql&"WHERECustid="&cid
onerrorresumenext
conn.Executesql
iferr<>0then
response.write("Noupdatepermissions!")
else
response.write("Record"&cid&"wasupdated!")
endif
endif
conn.close
%></body>
</html>
</CODE>
************************************************** ********************
J. Dyer
</blockquote id="quote"></font id="quote">