
August 16th, 2000, 03:13 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 23
|
|
|
ASP / PWS - only works once.. help!
<i><b>Originally posted by : curtis (eludz@hotmail.com)</b></i><br /><br />Can someone tell me why this code only works one time? I'm using a system DSN cause the book I have uses it, and it is just easier this way, once I get ASP all figured, I'll use DSN-less. Until then I want to get this code working EVERY TIME.. not just one database update, then the next time i try it just sits there.. doesn't make sense, because the oRs is being closed! Do I have to close the DSN a different way or does it look like it should be closing? thanks for the time spent.. I appreciate it!<br /><br />--- HTML FILE (smnewprob.html)<br /><html><br /><head><br /><title>Test Form</title><br /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br /></head><br /><br /><body bgcolor="#FFFFFF"><br /><form method="post" action="smupdatenew.asp"><br /><p align="center">Name: <br /><input type="text" name="txtName"><br /> Phone: <br /><input type="text" name="txtPhone"><br /></p><br /><p align="center"> Address: <br /><textarea name="txtAddress" cols="50" rows="2"></textarea><br /></p><br /><div align="center"><br /><input type="submit" value="SUBMIT"><br /></div><br /></form><br /></body><br /></html><br />--- HTML FILE (smnewprob.html)<br /><br /><br />--- ASP FILE (smnewupdate.asp)<br /><%@ LANGUAGE="VBSCRIPT" %><br /><!--#include file="adovbs.inc" --><br /><HTML><br /><HEAD><br /><title>Test UPDATE</title><br /></HEAD><br /><body bgcolor="#FFFFFF" text="#000000" link="#804040" vlink="#008080" alink="#004080"><br /><%<br />strName = cStr(Request.Form("txtName"))<br />strPhone = cStr(Request.Form("txtPhone"))<br />strAddress = cStr(Request.Form("txtAddress"))<br /><br />Set oRs = Server.CreateObject("ADODB.Recordset")<br />oRs.Open "tblMain", "DSN=Small;UID=;Password=;", adOpenKeyset, adLockPessimistic, adCmdTable <br />%><br /><H2 ALIGN=CENTER>Opened Successfully!</H2><br /><%<br />oRs.AddNew<br />oRS.Fields("Name") = strName<br />oRs.Fields("Phone") = strPhone<br />oRs.Fields("Address") = strAddress<br /><br />'save changes to database ("/small/small.mdb")<br />oRS.Update 'save the changes to the records<br />oRS.Close <br />Set oRS = Nothing<br />%><br /><P><br /><H2 ALIGN=CENTER>Thanks for your details!</H2><br />We've received your details and you'll be receiving a copy of our catalogue soon.<br />Once again, thanks for your interest.<br /><P><br /></BODY><br /></HTML><br />--- ASP FILE (smnewupdate.asp)
|