473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Cannot update


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
1 2208
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Simon | last post by:
Hi I am trying to produce an update trigger. I understand the concept of delete and insert triggers without a problem. Unfortuantely, the update triggers do not have particularly simple...
0
by: mr_wizard | last post by:
I posted a message yesterday on my difficulty in updating an Access table. Yesterday the error response was permission related. I've gotten past that, but still cannot update the table. XP Pro...
3
by: Lori Markle via .NET 247 | last post by:
(Type your message here) Hi, I'm having a problem with binding a textbox to a dataset. Cananybody figure out what's going on here? I simply want to update a record. Type in a permit number...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
4
by: Ryan | last post by:
I've got a little bit of code that runs when you enter data in a datasheet view (which is a subform of the form you are in) if rst!DateReceived >= 30 Then Forms!DisposalRecords.Label90.Caption =...
1
by: nitinkhare1 | last post by:
Please help,I'm very frustated. when I ADD the data in kn_history_question table of htbase_tst database....it giving the error "Cannot add or update a child row:a foreign key constraint...
1
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta...
4
by: dougmeece | last post by:
Morning Everyone... I have a table that needs to be append to and also updated. All the fields in the table are populated with data from the text boxes and combo boxes on a form. The Date...
1
BeemerBiker
by: BeemerBiker | last post by:
Using GridView and SqlDataSource I found that an index field defaults to "ReadOnly=True" and I have to change it to False and then hide it before my sql UPDATE command works. This seems awkward and...
3
by: pinko1204 | last post by:
My Update function cannot successful update to sql table even don't have any error. Please help to check .....thx PHP1 <?php require_once 'header.php'; ?> <style type="text/css"> <!--
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.