473,739 Members | 4,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot update


As attached is the code :

<% Option Explicit

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

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

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

response.redire ct "default.as p"
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(Re quest("realname "))
uage = FormatString(Re quest("uage"))
gender = FormatString(Re quest("Gender") )
uContact = FormatString(Re quest("uContact "))
uModel = FormatString(Re quest("uModel") )
uPlate = FormatString(Re quest("uPlate") )
location = FormatString(Re quest("location "))
website = FormatString(Re quest("website" ))
If len(website) > 1 then
If lCase(Left(webs ite, 4)) <> "http" then website = "http://"
website
End If
aol = FormatString(Re quest("aol"))
icq = FormatString(Re quest("icq"))
msn = FormatString(Re quest("msn"))
yahoo = FormatString(Re quest("yahoo"))
interests = FormatString(Re quest("interest s"))
sig = Request("sig")
postContent = sig
Set rsForums = Conn.Execute("S ELECT General.*, PER_TEMPLATE.* Fro
[General] INNER JOIN PER_TEMPLATE ON General.PER" & intGroup & "
PER_TEMPLATE.TE MPLATE_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="FormatPos t.asp" -->
<%
sig = postContent

avatar = FormatString(Re quest("avatar") )
HideEmail = Request("hideem ail")
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><%=Appli cation("FORUM_T ITLE")%> 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.as p" -->
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="0"
align="center" class="tdBorder ">
<tr>
<td class="tdLighte st"><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="ima ges/topbar_grad.gif "> <div
align="center"> <img src="images/topbar_Profile. gif"></div></td>
<td width="6" align="right">< img
src="images/topbar_right.gi f" width="6" height="25"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="20" class="tdLighte st"> <p>&nbsp;<a
href="default.a sp">o0mBBS</a>
&gt; <a href="cpanel.as p">Control Panel</a> &gt; Update
Profile</p></td>
</tr>
<tr>
<td colspan="3" class="tdLighte st">
<table width="100%" border="0" cellspacing="0" cellpadding="10 ">
<tr>
<td><table width="100%" border="0" cellspacing="1"
cellpadding="5" class="tdBorder ">
<tr class="tdLighte st">
<td><p align="center"> <a
href="cpanel.as p">Overview</a></p></td>
<td><p align="center"> <strong>Updat e 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">P rivate
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="UpdateP rofile.asp?upda te=true">
<table width="100%" border="0" cellpadding="5"
cellspacing="1" class="tdBorder ">
<tr class="tdHeader ">
<td height="15" colspan="2"> <p align="center"
class="tdHeader Font"><strong>E dit
My Profile</strong></p></td>
</tr>
<tr class="tdLighte st">
<td width="150" height="15" class="tdLight" ><p
align="right">I d
: </p></td>
<td><p><%=rsUse rs.Fields("uID" )%></p></td>
</tr>
<tr class="tdLighte st">
<td height="30" class="tdLight" > <p
align="right">N ame :</p></td>
<td> <p><%=rsUsers.F ields("uName")% ></p></td>
</tr>
<tr class="tdLighte st">
<td height="30" class="tdLight" > <p
align="right">E mail : </p></td>
<td><p>
<input name="email" type="text" class="button"
id="email" value="<%=rsUse rs.Fields("uEma il")%>" size="50">
<% if elen = true then %>
*Need proper email address
<% end if %>
</p></td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p align="right">R eal
Name :
</p></td>
<td><input name="realname" type="text" class="button"
value="<%=rsUse rs("RealName")% >" size="50"></td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p align="right">A ge
:
</p></td>
<td><input name="uage" type="text" class="button"
value="<%=rsUse rs("uage")%>" size="10"></td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p
align="right">G ender : </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="tdLighte st">
<td height="15" class="tdLight" > <p
align="right">C ontact No :
</p></td>
<td> <input type="text" name="uContact"
value="<%=rsUse rs("uContact")% >" class="button">
</td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" > <p align="right">C ar
Model :
</p></td>
<td> <input type="text" name="uModel"
value="<%=rsUse rs("uModel")%> " class="button">
</td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" > <p align="right">C ar
Plate No. :
</p></td>
<td> <input type="text" name="uPlate"
value="<%=rsUse rs("uPlate")%> " class="button">
</td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" > <p
align="right">L ocation :
</p></td>
<td> <input type="text" name="location"
value="<%=rsUse rs("Location")% >" class="button">
</td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p
align="right">W ebsite : </p></td>
<td><input name="website" type="text"
value="<%=rsUse rs("WebSite")%> " class="button"> </td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p align="right">A OL
: </p></td>
<td><input name="aol" type="text"
value="<%=rsUse rs("AOL")%>" class="button"> </td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p align="right">I CQ
: </p></td>
<td><input name="icq" type="text"
value="<%=rsUse rs("ICQ")%>" class="button"> </td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p align="right">M SN
: </p></td>
<td><input name="msn" type="text"
value="<%=rsUse rs("MSN")%>" class="button"> </td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p
align="right">Y ahoo : </p></td>
<td><input name="yahoo" type="text"
value="<%=rsUse rs("YAHOO")%>" class="button"> </td>
</tr>
<tr class="tdLighte st">
<td height="15" class="tdLight" ><p
align="right">I nterests :
</p></td>
<td><textarea name="interests "
class="button"> <%=rsUsers.Fiel ds("Interests") %></textarea>
</td>
</tr>
<tr class="tdLighte st">
<td height="30" class="tdLight" > <p
align="right">R egistered
On : </p></td>
<td> <p><%=rsUsers.F ields("Register edOn")%></p></td>
</tr>
<tr class="tdLighte st">
<td height="30" class="tdLight" > <p
align="right">P osts : </p></td>
<td> <p><%=rsUsers.F ields("Posts")% ></p></td>
</tr>
<tr class="tdLighte st">
<td height="30" class="tdLight" > <p align="right">S ig
: </p></td>
<td> <textarea name="sig" class="button"> <%If
rsUsers("Sig") <> "" then response.write
ConvertBack(rsU sers.Fields("Si g"))%></textarea>
</td>
</tr>
<tr class="tdLighte st">
<td class="tdLight" > <p align="right">H ide my email:
</p></td>
<td> <input name="hideemail " type="checkbox"
value="true" <% if rsUsers("HideEm ail") = true then %> checked<% end if
%>></td>
</tr>
<% if Application("AV _ENABLED") = true then %>
<tr class="tdLighte st">
<td class="tdLight" > <p
align="right">A vatar</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="<%=rsUse rs("Avatar")%>" >
</p>
</td>
<td align="center"> <p><strong>Curr ent
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="tdLighte st">
<td colspan="2"> <div align="center">
<input name="enBB" type="hidden" id="enBB" value="true">
<input name="profile" type="hidden" id="profile"
value="<%=profi le%>">
<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 2241
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
2577
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 documentation in BoL. So, can someone please explain to me, quite simply how I would produce a trigger on the following: I have table 1 which we'll call simon. In here are various columns and
0
534
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 IIS 5 Access 2002 ASP page ODBC File DSN = "Twmp DBs" The error message on an SQL update is :Cannot update. Database or object is
3
1376
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 andsave it to the database. I get the "cannot bind to columnpermitnumber on datasource" error, or if I add the tablename.column name into the binding, a permit number that alreadyexists pops up. Here is my code: Dim dbConn As...
6
10679
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 data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the...
4
5043
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 = (Date - rst!DateReceived) & " Days" however, when that runs to update the caption, it says that it cannot find form DisposalRecords
1
5969
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 fails,<'htbase_tst/kn_history_question', CONSTRAINT 'FK_kn_history_question_complaint' FOREIGN KEY ('complaint_id' ) REFERENCES 'complaint'('id')). This is my table script..... CREATE TABLE `city` ( `id` int(11) NOT NULL auto_increment, ...
1
2466
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 http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Order Record</title> <meta name="Microsoft Border" content="tlb, default"> </head>
4
2407
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 Submitted defaults to 1/1/00 if the cboSubmittedBox field is "No". Otherwise it is selected from a calendar. The Date Entered field defaults to the current date. There are 3 sets of criteria that need to be checked for the update or append to take place. ...
1
2190
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 I was wondering if there was a better way of getting a GridView to work with MS SQL. GridView1: -SelectCommand = "SELECT * FROM xxx" -UpdateCommand="UPDATE xxx SET yyy WHERE =@index; The SELECT gets "index". If I explicitly code the select so...
3
2320
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
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.