|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Trouble updating my database with an ASP page
<i><b>Originally posted by : David (branham@bright.net)</b></i><br />I've been trying this for two weeks now without much success. It is supposed to update four values in my database. When I try to run the page, i get the error at the very bottom. I have no trouble selecting the values and getting them into the input boxes, its getting the second page to update the records. What am i doing wrong?<br /><br />I also have a second question. I'm using a cookie password system in conjunction with a table in my database. I set the username of the cookie=username . If you notice in my first page, the select page, I've had to physically add a value <WHERE tblSqlAdd.Callsign = Pallos>. I want to put my username value in there so that the record selected is that of the person loging in. Is that possible? and if so how?<br /><br />############################################<br /><br /><%<br />Response.Expires = -1000 'Makes the browser not cache this page<br />Response.Buffer = True 'Buffers the content so our Response.Redirect will work<br /><br />If Session("UserLoggedIn") <> "true" Then<br /> Response.Redirect("login.asp")<br />End If<br />%><br /><%<br />username=Request.Cookies("name")%><br /><%<br />Dim MyConn, sSql, RS, Count, i<br /><br />Set MyConn=Server.CreateObject("ADODB.Connection")<br />MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=f:siteswww7
oosterdbadoandsqladd3.mdb")<br />sSql = "SELECT tblSqlAdd.Email, tblSqlAdd.ICQ, tblSqlAdd.biohref, tblSqlAdd.pichref FROM tblSqlAdd WHERE tblSqlAdd.Callsign='Pallos' ORDER BY tblSqlAdd.ICQ DESC"<br />Set RS = MyConn.Execute(sSql)<br />%><br /><br /><HTML><br /><HEAD><br /><TITLE>Saber Activity Meter</TITLE><br /></HEAD><br /><BODY BGCOLOR="#006699" background="saback.jpg" LINK="#000000" VLINK="#C0C0C0" ALINK="#000000 TEXT="#000000" topmargin="0"><br /><br /><br /><br /><center><br /><table width="640" height="120" border="0" cellspacing="0" cellpadding="0" background="top.jpg"><br /><tr><td></td><TD valign="bottom"></td></TR></TABLE><br /><br /><P><br /><br /><center><B>[<a href="http://www6.ewebcity.com/saber/matches.asp">Veiw Recent Matches</a>] [<a href="http://www.bright.net/~branham">Saber Wing Home</a>] [<a href="http://www.starfighters.com/boards/saber/">Saber Wing Message Board</a>] [<a href="mailto:branham@bright.net">Report Bugs</a>]</B></center><br /><P><br /><br /><TABLE ALIGN="center" height="173" WIDTH="400" BORDER="0" background="dback.jpg" BGCOLOR="#C0C0C0" <br />CELLPADDING="0" CELLSPACING="0"><TR height="19" valign="top"><TD><IMG SRC="sabarntx.jpg"></TD></TR><br /><TR height="135" valign="center"><br /><TD><br /><br /><font color="#ffffff"><br /><center><B><%Response.Write(username)%></B>, welcome to the Player Update section of the Saber Database.<br /></P><br /><br /><P><br />You may change all of your information from this page, except your callsign. To change your callsign will mean that you must re-register from the begining. To change your data, deleate the old information out of the text box, and type in your new information. Then click the Update Stats button.</center></font><br /></P><br /></TD><br /></TR><br /><TR valign="bottom" height="19"><TD><IMG SRC="sabar.jpg"></TD></TR></TABLE><br /></P><br /><br /><br /><br /><br /><br /><br /><P><br /><br /> <br /><div align="center"><br /> <table border=1><br /> <tr> <% For i= 0 to RS.Fields.Count - 1 %> <br /> <th BGCOLOR="#C0C0C0"><font color="000000"><% = RS(i).Name %></font></th><br /> <% Next %> </tr><br /> <% Count = 0 %> <% While Not RS.EOF %> <br /> <tr> <% for i= 0 to RS.Fields.Count - 1 %> <% If Count = 0 Then %> <br /> <td bgcolor="#c0c0c0"><div align="center"><form method="post" name="form1" action="updateplayerstats.asp"><font color="000000"><input type="text" size="25" name="<% = RS(i).Name %>" value="<% = RS(i) %>"></font></div></td><br /> <% Else %> <br /> <td bgcolor="#c0c0c0"><div align="center"><font color="000000"><input type="text" size="25" name="<% = RS(i).Name %>" value="<% = RS(i) %>"></font></div></td><br /> <% End If %> <% Next %> </tr></font><br /></table><br /><P><br /><table border=1><br /> <tr><td><input type="Submit" value="Update Player Stats" name"b1"></td></tr></table></form><br /> <br /><br /><%<br />Count = Count + 1<br /><br />If Count = 2 Then Count = 0<br /><br /><br />RS.MoveNext<br />WEND<br />RS.Close<br />Set RS = Nothing<br />%> <br /> </table><br /></div><br /></BODY><br /></HTML><br /><br />############################################<br /><br /><%@ Language="VBScript"%><br /><html><br /><head><br /><title>ASPfree.com: <% =strTitle %></title><br /><br /></head><br /><body><br /><br /><br /><%<br /><br />strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/adoandsqladd3.mdb")<br />dim conn<br />dim rs<br />dim strID<br /><br />Dim strEmail<br />Dim strICQ<br />Dim strbiohref<br />Dim strpichref<br /><br />strEmail = Request.Form("Email")<br />strICQ = Request.Form("ICQ") <br />strbiohref = Request.Form("biohref")<br />strpichref = Request.Form("pichref")<br /><br /><br />set conn = server.createobject("adodb.connection")<br />conn.open strconn<br />set rs = server.createobject("adodb.recordset")<br />rs.open "tblSqlAdd", conn, 2, 2<br /><br /><br />sql = "update tblSqlAdd set"<br />sql = sql & "tblSqlAdd.Email = '" & strEmail & "',"<br />sql = sql & "tblSqlAdd.ICQ = '" & strICQ & "',"<br />sql = sql & "tblSqlAdd.biohref = '" & strbiohref & "' "<br />sql = sql & "tblSqlAdd.pichref = '" & strpichref & "' "<br />sql = sql & "where tblSqlAdd.Callsign = '" & Pallos & "'"<br />rs.update<br />%><br /><br /><p>Here are the results of what you've done!</p><br /><table BORDER="0"><br /> <tr><td><strong>Email</strong></td><td><% = rs("strEmail")%></td></TR><TR><td><br /> <strong>ICQ</strong></td><td><% = rs("strICQ")%></td></TR><TR><TD><br /> <strong>Bio URL</strong></td><td><% = rs("strbiohref")%></td></TR><TR><br /> <TD><strong>Pic URL</strong></td><td><% = rs("strpichref")%></td></tr><br /></table><br /><br /><br /><br /><% <br />set rs= nothing<br />set conn = nothing<br />%><br /><br /><br /></body><br /></html><br /><br />#############################################<br /><br />Here are the results of what you've done!<br /><br />Email ADODB.Recordset error '800a0cc1' <br /><br />Item cannot be found in the collection corresponding to the requested name or ordinal. <br /><br />/rooster/updateplayerstats.asp, line 45 <br /> <br /><br /> |
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : uday (kuday99@hotmail.com)</b></i><br />Hello<br /><br /> U written Update Sql statement, finally Ur updating recordset object. That's why Ur receiving that error.<br />U just code <br /><br />MyConn.execute sql<br />after Sql string<br />That' it<br />any problem contact me<br />good luck<br />------------<br />David at 6/2/2000 1:25:42 PM<br /><br />I've been trying this for two weeks now without much success. It is supposed to update four values in my database. When I try to run the page, i get the error at the very bottom. I have no trouble selecting the values and getting them into the input boxes, its getting the second page to update the records. What am i doing wrong?<br /><br />I also have a second question. I'm using a cookie password system in conjunction with a table in my database. I set the username of the cookie=username . If you notice in my first page, the select page, I've had to physically add a value <WHERE tblSqlAdd.Callsign = Pallos>. I want to put my username value in there so that the record selected is that of the person loging in. Is that possible? and if so how?<br /><br />############################################<br /><br /><%<br />Response.Expires = -1000 'Makes the browser not cache this page<br />Response.Buffer = True 'Buffers the content so our Response.Redirect will work<br /><br />If Session("UserLoggedIn") <> "true" Then<br /> Response.Redirect("login.asp")<br />End If<br />%><br /><%<br />username=Request.Cookies("name")%><br /><%<br />Dim MyConn, sSql, RS, Count, i<br /><br />Set MyConn=Server.CreateObject("ADODB.Connection")<br />MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=f:siteswww7
oosterdbadoandsqladd3.mdb")<br />sSql = "SELECT tblSqlAdd.Email, tblSqlAdd.ICQ, tblSqlAdd.biohref, tblSqlAdd.pichref FROM tblSqlAdd WHERE tblSqlAdd.Callsign='Pallos' ORDER BY tblSqlAdd.ICQ DESC"<br />Set RS = MyConn.Execute(sSql)<br />%><br /><br /><HTML><br /><HEAD><br /><TITLE>Saber Activity Meter</TITLE><br /></HEAD><br /><BODY BGCOLOR="#006699" background="saback.jpg" LINK="#000000" VLINK="#C0C0C0" ALINK="#000000 TEXT="#000000" topmargin="0"><br /><br /><br /><br /><center><br /><table width="640" height="120" border="0" cellspacing="0" cellpadding="0" background="top.jpg"><br /><tr><td></td><TD valign="bottom"></td></TR></TABLE><br /><br /><P><br /><br /><center><B>[<a href="http://www6.ewebcity.com/saber/matches.asp">Veiw Recent Matches</a>] [<a href="http://www.bright.net/~branham">Saber Wing Home</a>] [<a href="http://www.starfighters.com/boards/saber/">Saber Wing Message Board</a>] [<a href="mailto:branham@bright.net">Report Bugs</a>]</B></center><br /><P><br /><br /><TABLE ALIGN="center" height="173" WIDTH="400" BORDER="0" background="dback.jpg" BGCOLOR="#C0C0C0" <br />CELLPADDING="0" CELLSPACING="0"><TR height="19" valign="top"><TD><IMG SRC="sabarntx.jpg"></TD></TR><br /><TR height="135" valign="center"><br /><TD><br /><br /><font color="#ffffff"><br /><center><B><%Response.Write(username)%></B>, welcome to the Player Update section of the Saber Database.<br /></P><br /><br /><P><br />You may change all of your information from this page, except your callsign. To change your callsign will mean that you must re-register from the begining. To change your data, deleate the old information out of the text box, and type in your new information. Then click the Update Stats button.</center></font><br /></P><br /></TD><br /></TR><br /><TR valign="bottom" height="19"><TD><IMG SRC="sabar.jpg"></TD></TR></TABLE><br /></P><br /><br /><br /><br /><br /><br /><br /><P><br /><br /> <br /><div align="center"><br /> <table border=1><br /> <tr> <% For i= 0 to RS.Fields.Count - 1 %> <br /> <th BGCOLOR="#C0C0C0"><font color="000000"><% = RS(i).Name %></font></th><br /> <% Next %> </tr><br /> <% Count = 0 %> <% While Not RS.EOF %> <br /> <tr> <% for i= 0 to RS.Fields.Count - 1 %> <% If Count = 0 Then %> <br /> <td bgcolor="#c0c0c0"><div align="center"><form method="post" name="form1" action="updateplayerstats.asp"><font color="000000"><input type="text" size="25" name="<% = RS(i).Name %>" value="<% = RS(i) %>"></font></div></td><br /> <% Else %> <br /> <td bgcolor="#c0c0c0"><div align="center"><font color="000000"><input type="text" size="25" name="<% = RS(i).Name %>" value="<% = RS(i) %>"></font></div></td><br /> <% End If %> <% Next %> </tr></font><br /></table><br /><P><br /><table border=1><br /> <tr><td><input type="Submit" value="Update Player Stats" name"b1"></td></tr></table></form><br /> <br /><br /><%<br />Count = Count + 1<br /><br />If Count = 2 Then Count = 0<br /><br /><br />RS.MoveNext<br />WEND<br />RS.Close<br />Set RS = Nothing<br />%> <br /> </table><br /></div><br /></BODY><br /></HTML><br /><br />############################################<br /><br /><%@ Language="VBScript"%><br /><html><br /><head><br /><title>ASPfree.com: <% =strTitle %></title><br /><br /></head><br /><body><br /><br /><br /><%<br /><br />strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/adoandsqladd3.mdb")<br />dim conn<br />dim rs<br />dim strID<br /><br />Dim strEmail<br />Dim strICQ<br />Dim strbiohref<br />Dim strpichref<br /><br />strEmail = Request.Form("Email")<br />strICQ = Request.Form("ICQ") <br />strbiohref = Request.Form("biohref")<br />strpichref = Request.Form("pichref")<br /><br /><br />set conn = server.createobject("adodb.connection")<br />conn.open strconn<br />set rs = server.createobject("adodb.recordset")<br />rs.open "tblSqlAdd", conn, 2, 2<br /><br /><br />sql = "update tblSqlAdd set"<br />sql = sql & "tblSqlAdd.Email = '" & strEmail & "',"<br />sql = sql & "tblSqlAdd.ICQ = '" & strICQ & "',"<br />sql = sql & "tblSqlAdd.biohref = '" & strbiohref & "' "<br />sql = sql & "tblSqlAdd.pichref = '" & strpichref & "' "<br />sql = sql & "where tblSqlAdd.Callsign = '" & Pallos & "'"<br />rs.update<br />%><br /><br /><p>Here are the results of what you've done!</p><br /><table BORDER="0"><br /> <tr><td><strong>Email</strong></td><td><% = rs("strEmail")%></td></TR><TR><td><br /> <strong>ICQ</strong></td><td><% = rs("strICQ")%></td></TR><TR><TD><br /> <strong>Bio URL</strong></td><td><% = rs("strbiohref")%></td></TR><TR><br /> <TD><strong>Pic URL</strong></td><td><% = rs("strpichref")%></td></tr><br /></table><br /><br /><br /><br /><% <br />set rs= nothing<br />set conn = nothing<br />%><br /><br /><br /></body><br /></html><br /><br />#############################################<br /><br />Here are the results of what you've done!<br /><br />Email ADODB.Recordset error '800a0cc1' <br /><br />Item cannot be found in the collection corresponding to the requested name or ordinal. <br /><br />/rooster/updateplayerstats.asp, line 45 <br /> <br /><br /> |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Trouble updating my database with an ASP page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|