By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

Cannot update

P: n/a

As attached is the code :

<% Option Explicit

dim lngTimer
lngTimer = Timer
%>
<!--#include file="Connect.asp" -->
<!--#include file="Settings.asp" -->
<!--#include file="Common.asp" -->

<% Dim profile, rsUsers, pdon, apos, elen, postContent, postSubject
topic, avatar, abortUpdate, img, i, rsForums
if not intUID = 0 then Conn.Execute("UPDATE [Users] SE
[LastActivePlace] = ""profile.asp?profile=" & Request("profile") & """
[LastLoggedIn]= now(), [IP] = '" & GetIP & "' WHERE [uID]=" & intUID)

if intUID <> 0 then 'if someone has requested a profile
Set rsUsers = Conn.Execute("SELECT * From [Users] WHERE [uID] = "
intUID)
Else
Set Conn = nothing
rsUsers.close

response.redirect "default.asp"
end if

If Request("update") = "true" then

function FormatString(x)
x = replace(x, "'", "''")
'x = replace(x, """", """""")
x = Replace(x, "<", "&lt;")
x = Replace(x, ">", "&gt;")
x = Replace(x, vbCrLf, "<br>")
FormatString = x
end function

'get data, validate it
dim strSQL, dbpass, email, RealName, uage, Gender, uContact, uModel
uPlate, location, website, aol, icq, msn, yahoo, interests, sig
HideEmail
email = Replace(Request("email"), "'", "''")
if len(email) < 6 then elen = true
if instr(email, "@") = 0 then elen = true
'response.write instr("asd", "@") & " : " & instr("asd@asd", "@")
realname = FormatString(Request("realname"))
uage = FormatString(Request("uage"))
gender = FormatString(Request("Gender"))
uContact = FormatString(Request("uContact"))
uModel = FormatString(Request("uModel"))
uPlate = FormatString(Request("uPlate"))
location = FormatString(Request("location"))
website = FormatString(Request("website"))
If len(website) > 1 then
If lCase(Left(website, 4)) <> "http" then website = "http://"
website
End If
aol = FormatString(Request("aol"))
icq = FormatString(Request("icq"))
msn = FormatString(Request("msn"))
yahoo = FormatString(Request("yahoo"))
interests = FormatString(Request("interests"))
sig = Request("sig")
postContent = sig
Set rsForums = Conn.Execute("SELECT General.*, PER_TEMPLATE.* Fro
[General] INNER JOIN PER_TEMPLATE ON General.PER" & intGroup & "
PER_TEMPLATE.TEMPLATE_ID") 'should hopefully stop errors occuring i
formatpost.asp
dim POST_HTML, POST_BB, POST_SMILIE, POST_IMG
POST_HTML = false
POST_BB = true
POST_SMILIE = true
POST_IMG = true
%>
<!--#include file="FormatPost.asp" -->
<%
sig = postContent

avatar = FormatString(Request("avatar"))
HideEmail = Request("hideemail")
if HideEmail = "true" then HideEmail = true else HideEmail = false

'update record
'if not abortUpdate = true then 'if all good then
strSQL = "UPDATE [Users] SET "
if not elen = true then
strSQL = strSQL & "[uEmail] = '" & email & "', "
end if
strSQL = strSQL & "[RealName] = '" & realname & "', "
strSQL = strSQL & "[uAge] = '" & uage & "', "
strSQL = strSQL & "[Gender] = '" & gender & "', "
strSQL = strSQL & "[uContact] = '" & uContact & "', "
strSQL = strSQL & "[uModel] = '" & uModel & "', "
strSQL = strSQL & "[uPlate] = '" & uPlate & "', "
strSQL = strSQL & "[location] = '" & location & "', "
strSQL = strSQL & "[website] = '" & website & "', "
strSQL = strSQL & "[icq] = '" & icq & "', "
strSQL = strSQL & "[msn] = '" & msn & "', "
strSQL = strSQL & "[aol] = '" & aol & "', "
strSQL = strSQL & "[yahoo] = '" & yahoo & "', "
strSQL = strSQL & "[interests] = '" & interests & "', "
strSQL = strSQL & "[sig] = '" & sig & "', "

if Application("AV_ENABLED") = true then
strSQL = strSQL & "[Avatar] = '" & avatar & "', "
end if
strSQL = strSQL & "[HideEmail] = " & HideEmail & ", "
strSQL = strSQL & " WHERE uID = " & intUID
'response.write strSQL
Conn.Execute (strSQL)
end if
'end if
rsUsers.Requery

intOffSet = rsUsers("Offset")
%>
<html>
<head>
<title><%=Application("FORUM_TITLE")%> Profile</title>
<meta http-equiv="Content-Type" content="text/html
charset=iso-8859-1">
<link rel="stylesheet" href="o0m.css" type="text/css">
</head>

<body text="#000000">
<!--#include file="header.asp" -->
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="0"
align="center" class="tdBorder">
<tr>
<td class="tdLightest"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td width="9"><img src="images/topbar_Left.gif" width="9"
height="25"></td>
<td background="images/topbar_grad.gif"> <div
align="center"><img src="images/topbar_Profile.gif"></div></td>
<td width="6" align="right"><img
src="images/topbar_right.gif" width="6" height="25"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="20" class="tdLightest"> <p>&nbsp;<a
href="default.asp">o0mBBS</a>
&gt; <a href="cpanel.asp">Control Panel</a> &gt; Update
Profile</p></td>
</tr>
<tr>
<td colspan="3" class="tdLightest">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td><table width="100%" border="0" cellspacing="1"
cellpadding="5" class="tdBorder">
<tr class="tdLightest">
<td><p align="center"><a
href="cpanel.asp">Overview</a></p></td>
<td><p align="center"><strong>Update Profile</strong>
</p></td>
<td><p align="center"><a href="editpass.asp">Edit
Password</a></p></td>
<td><p align="center"><a href="pm.asp">Private
Messages</a></p></td>
<td><p align="center"><a href="theme.asp">Theme
Manager</a></p></td>
<td><p align="center"><a href="buddyList.asp">Buddy
List</a></p></td>
<td><p align="center"><a
href="faq.asp">Help</a></p></td>
</tr>
</table>
<br>
<form name="form1" method="post"
action="UpdateProfile.asp?update=true">
<table width="100%" border="0" cellpadding="5"
cellspacing="1" class="tdBorder">
<tr class="tdHeader">
<td height="15" colspan="2"> <p align="center"
class="tdHeaderFont"><strong>Edit
My Profile</strong></p></td>
</tr>
<tr class="tdLightest">
<td width="150" height="15" class="tdLight"><p
align="right">Id
: </p></td>
<td><p><%=rsUsers.Fields("uID")%></p></td>
</tr>
<tr class="tdLightest">
<td height="30" class="tdLight"> <p
align="right">Name :</p></td>
<td> <p><%=rsUsers.Fields("uName")%></p></td>
</tr>
<tr class="tdLightest">
<td height="30" class="tdLight"> <p
align="right">Email : </p></td>
<td><p>
<input name="email" type="text" class="button"
id="email" value="<%=rsUsers.Fields("uEmail")%>" size="50">
<% if elen = true then %>
*Need proper email address
<% end if %>
</p></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p align="right">Real
Name :
</p></td>
<td><input name="realname" type="text" class="button"
value="<%=rsUsers("RealName")%>" size="50"></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p align="right">Age
:
</p></td>
<td><input name="uage" type="text" class="button"
value="<%=rsUsers("uage")%>" size="10"></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p
align="right">Gender : </p></td>
<td><select name="gender" class="button" ID=Select1>
<option value="0"<%If rsUsers("gender") = "0" then %>
selected<% end if %>>Undisclosed</option>
<option value="1"<%If rsUsers("gender") = "1" then %>
selected<% end if %>>Male</option>
<option value="2"<%If rsUsers("gender") = "2" then %>
selected<% end if %>>Female</option>
</select></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"> <p
align="right">Contact No :
</p></td>
<td> <input type="text" name="uContact"
value="<%=rsUsers("uContact")%>" class="button">
</td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"> <p align="right">Car
Model :
</p></td>
<td> <input type="text" name="uModel"
value="<%=rsUsers("uModel")%>" class="button">
</td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"> <p align="right">Car
Plate No. :
</p></td>
<td> <input type="text" name="uPlate"
value="<%=rsUsers("uPlate")%>" class="button">
</td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"> <p
align="right">Location :
</p></td>
<td> <input type="text" name="location"
value="<%=rsUsers("Location")%>" class="button">
</td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p
align="right">Website : </p></td>
<td><input name="website" type="text"
value="<%=rsUsers("WebSite")%>" class="button"></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p align="right">AOL
: </p></td>
<td><input name="aol" type="text"
value="<%=rsUsers("AOL")%>" class="button"></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p align="right">ICQ
: </p></td>
<td><input name="icq" type="text"
value="<%=rsUsers("ICQ")%>" class="button"></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p align="right">MSN
: </p></td>
<td><input name="msn" type="text"
value="<%=rsUsers("MSN")%>" class="button"></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p
align="right">Yahoo : </p></td>
<td><input name="yahoo" type="text"
value="<%=rsUsers("YAHOO")%>" class="button"></td>
</tr>
<tr class="tdLightest">
<td height="15" class="tdLight"><p
align="right">Interests :
</p></td>
<td><textarea name="interests"
class="button"><%=rsUsers.Fields("Interests")%></textarea>
</td>
</tr>
<tr class="tdLightest">
<td height="30" class="tdLight"> <p
align="right">Registered
On : </p></td>
<td> <p><%=rsUsers.Fields("RegisteredOn")%></p></td>
</tr>
<tr class="tdLightest">
<td height="30" class="tdLight"> <p
align="right">Posts : </p></td>
<td> <p><%=rsUsers.Fields("Posts")%></p></td>
</tr>
<tr class="tdLightest">
<td height="30" class="tdLight"> <p align="right">Sig
: </p></td>
<td> <textarea name="sig" class="button"><%If
rsUsers("Sig") <> "" then response.write
ConvertBack(rsUsers.Fields("Sig"))%></textarea>
</td>
</tr>
<tr class="tdLightest">
<td class="tdLight"> <p align="right">Hide my email:
</p></td>
<td> <input name="hideemail" type="checkbox"
value="true" <% if rsUsers("HideEmail") = true then %> checked<% end if
%>></td>
</tr>
<% if Application("AV_ENABLED") = true then %>
<tr class="tdLightest">
<td class="tdLight"> <p
align="right">Avatar</p></td>
<td> <table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td valign="top"> <p>
<input name="avatar" type="text"
class="button" id="avatar" value="<%=rsUsers("Avatar")%>">
</p>
</td>
<td align="center"> <p><strong>Current
IMG</strong></p>
<p>
<% if rsUsers("Avatar") <> "" then %>
<img src="<%=rsUsers("Avatar")%>"
alt="avatar">
<% else %>
None
<% end if %>
</p></td>
</tr>
</table></td>
</tr><% end if %>
<tr class="tdLightest">
<td colspan="2"> <div align="center">
<input name="enBB" type="hidden" id="enBB" value="true">
<input name="profile" type="hidden" id="profile"
value="<%=profile%>">
<input type="submit" name="Submit" value="Update"
class="button">
</div></td>
</tr>
</table>
</form>

</td>
</tr>
</table>

</td>
</tr>
</table>
<br>
<br>
<!--#include file="../common/footer.asp" -->
</body>
</html>
<% rsUsers.close
Conn.close
%>

--
revolnip
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
1. tell us what database type and version you are using
2. You are having a problem with a query - don't make us wade through a
bunch of irrelevant html, etc to find the statement that's causing the
problem. Extract the section of code that contains the line of code that
raises the error and clearly label the line as the problem.
3. Tell us the exact error message.
4. You are using dynamic sql (which is not recommended - use Google to see
why). You cannot debug sql statements without knowing what is being sent to
the database. The only way to do that is to assign the statement to a
variable and response.write it:
strSQL = "Update ... "
response.write strSQL
Response.End

Conn.Execute strSQL,,1

Just as a guess, based on your subject, try these articles:
http://www.aspfaq.com/show.asp?id=2062 - updatable cursor
http://www.aspfaq.com/show.asp?id=2009 - 80004005 errors

revolnip wrote:
As attached is the code :

<snip>

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.