Error while trying the update query

Please support our ASP advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jun 2005
Posts: 1,409
Reputation: goldeagle2005 is an unknown quantity at this point 
Solved Threads: 43
Team Colleague
goldeagle2005's Avatar
goldeagle2005 goldeagle2005 is offline Offline
Finkus Stinkalotus

Error while trying the update query

 
0
  #1
Oct 14th, 2005
Hi,
Okay, here's the deal. I've created a project which requires user registration. Now, the registration part works like a dream. However, when I tried implementing an option where the user can update his details, the update isn't working. It says I have an error in my update statement. I'm posting the code here. For the first recordset, when I comment out the line which actually carries out the command, the asp works perfectly. However, when I try to uncomment it and run the asp, I get an error :Error in UPDATE query". I've checked the asp and it's fine. Can anyone help me out please?

<%@ Language="VBScript" %>
<%reg=Request("reg")%>
<%
if reg = 1 then
%>


<%

Set con1 = server.CreateObject ("ADODB.Connection")
Set rs1 = server.CreateObject ("ADODB.Recordset")

con1.Provider="Microsoft.Jet.OLEDB.4.0"
con1.Open (server.MapPath ("\databasecore\mediaguide.mdb"))


sql = "UPDATE authenticatedusers SET "
sql=sql & "password='"&TRIM(Request.Form("output"))&"', "
sql=sql & "name='"&TRIM(Request.Form("name"))&"', "
sql=sql & "address='"&TRIM(Request.Form("address"))&"', "
sql=sql & "country='"&TRIM(Request.Form("country"))&"', "
sql=sql & "age='"&TRIM(Request.Form("age"))&"', "
sql=sql & "tel='"&TRIM(Request.Form("tel"))&"', "
sql=sql & "dateofbirth='"&TRIM(Request.Form("dateofbirth"))&"', "
sql=sql & "monthofbirth='"&TRIM(Request.Form("monthofbirth"))&"', "
sql=sql & "yearofbirth='"&TRIM(Request.Form("yearofbirth"))&"', "
sql=sql & "email='"&TRIM(Request.Form("email"))&"' "
sql=sql & "WHERE username='"&Request.QueryString("user")&"'"
rs1.Open sql, con1

response.write(sql)

end if



Set con2 = server.CreateObject ("ADODB.Connection")
Set rs2 = server.CreateObject ("ADODB.Recordset")

con2.Provider="Microsoft.Jet.OLEDB.4.0"
con2.Open (server.MapPath ("\databasecore\mediaguide.mdb"))

sql2="SELECT * FROM authenticatedusers WHERE username='"&Request.QueryString("user")&"'"

rs2.Open sql2,con2
%>
<HTML>
<HEAD>
<TITLE>Registration</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var str_in;
var str_out = "";
var num_in;
var num_out = "";

function str_to_num(form) {
num_out = "";
if(form.password.value == "") ;
else {
str_in = escape(form.password.value);
for(i = 0; i < str_in.length; i++) {
num_out += str_in.charCodeAt(i) - 23;
}


rannum=str_in.length+32
pwhash=rannum*num_out/100000000000
finalop=pwhash+rannum
form.output.value = finalop;
}
}
</script>

<SCRIPT>
function password()
{
window.open("passwordeg.htm", "","toolbar=no, height=650, width=600, directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no")
}
</SCRIPT>
<meta name="Microsoft Theme" content="folio 111, default">
</HEAD>
<BODY><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="100%">
<p align="right">
<!--webbot bot="Navigation" S-Type="banner" S-Orientation="horizontal" S-Rendering="graphics" --><br>
<font size="2">
<!--webbot bot="Navigation" S-Orientation="horizontal" S-Rendering="html" S-Bar="Bars" S-Btn-Nml="&lt;A HREF=&quot;#URL#&quot; TARGET=&quot;#TARGET#&quot; STYLE=&quot;{text-decoration: none;}&quot;&gt;#LABEL#&lt;/A&gt;" S-Btn-Sel="#LABEL#" S-Btn-Sep="&amp;nbsp;|&amp;nbsp;" S-Type="top" B-Include-Home="TRUE" B-Include-Up="FALSE" --></font></p>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="50%">


<!--BEGIN JAVASCRIPT FOR FORM VALIDITY-->

<SCRIPT LANGUAGE="Javascript">

var digit="0123456789";

function val()
{
if(username_v() && password_v())
if(name_v() && add_v())
if(telno_v() && email_v())
return true;
return false;
}

function username_v()
{
if(document.auth.username.value=="")
{
alert("Please enter a valid username");
document.auth.username.focus();
return false;
}
return true;
}

function password_v()
{

if(document.auth.password.value=="")
{
alert("Please enter password");
document.auth.password.focus();
return false;
}

if(document.auth.cnfrmpwd.value=="")
{
alert("Please re-type password");
document.auth.cnfrmpwd.focus();
return false;
}

if(document.auth.password.value!=document.auth.cnfrmpwd.value)
{
alert("Please re-type password correctly");
document.auth.password.select();
document.auth.cnfrmpwd.value="";
return false;
}
return true;
}

function name_v()
{
if(document.auth.name.value=="")
{
alert("Please enter your name");
document.auth.name.focus();
return false;
}
return true;
}

function add_v()
{
if(document.auth.address.value=="")
{
alert("Please enter your address");
document.auth.address.focus();
return false;
}

if(document.auth.country.value=="")
{
alert("Please enter your country");
document.auth.country.focus();
return false;
}



if(document.auth.tel.value=="")
{
alert("Please enter your contact number");
document.auth.tel.focus();
return false;
}

if(document.auth.dateofbirth.value=="Date")
{
alert("Please select your Date of Birth");
document.auth.dateofbirth.focus();
return false;
}

if(document.auth.monthofbirth.value=="Month")
{
alert("Please select your Month of Birth");
document.auth.monthofbirth.focus();
return false;
}

if(document.auth.yearofbirth.value=="Year")
{
alert("Please select your Year of Birth");
document.auth.yearofbirth.focus();
return false;
}




if(document.auth.age.value=="")
{
alert("Please enter your Age");
document.auth.age.focus();
return false;
}
return true;
}

function telno_v()
{
if(document.auth.email.value=="")
{
alert("Please enter your email address");
document.auth.email.focus();
return false;
}
return true;
}

</script>


</td>
</tr>
</table></td>
</tr>
</table>
<p align="justify">The following form lists your details as provided. To update,
click the Update buttonx</p>

<p align="justify">Section 1: Login Information </p>
<blockquote>
<blockquote>
<p align="justify">In this section, you will be asked to enter a unique username
and password for identifying yourself to us. Please note that passwords are case
sensitive, so make sure you use the correct case.</p>
</blockquote>
</blockquote>
<!-- -->
<form name="auth" onSubmit="return val()" action="updateuserdetails.asp?reg=1&user=<%=Request.QueryString("user")%>" method="post">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="82%" height="45">
<tr>
<td width="100%" align="center" height="45" colspan="2">
<p align="center">Username:
<input type="text" size="30" name="username" value="<%=rs2("username")%>" readonly></p>
</td>
</tr>
<tr>
<td width="50%" align="center" height="45">
<blockquote>
<blockquote>
<blockquote>
<p align="justify">Password:<br>
<input type="password" size="30" name="password" maxlength="15"></blockquote>
</blockquote>
</blockquote>
</td>
<td width="50%" align="center" height="45">
<blockquote>
<blockquote>
<blockquote>
<p align="justify">Confirm Password:<br>
<input type="password" size="30" name="cnfrmpwd" maxlength="15">
<input type="hidden" size="30" name="output"></blockquote>
</blockquote>
</blockquote>
</td>
</tr>
</table>
</center>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<ul>
<li>
<p align="left"><font size="2">Passwords are case sensitive</font></li>
<li>
<p align="left"><font size="2">Ensure the password length is of 8 characters minimum
and 15 characters maximum [<a href="javascript:password()">What's this?</a>]</font></li>
</ul>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<hr>
</blockquote>
</blockquote>

<p align="justify">Section 2: Personal Information</p>
<blockquote>
<blockquote>
<p align="justify">In this section, we require you to fill out a few
personal details for our records. We will not sell or give out your personal
information to any third party.</p>
</blockquote>
</blockquote>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="50%" valign="top" align="center">Name:<br>
<input type="text" size="30" name="name" value="<%=rs2("name")%>"><p>Date of Birth:<br>
<input type="text" name="dateofbirth" size="12" value="<%=rs2("dateofbirth")%>"> /
<input type="text" name="monthofbirth" size="17" value="<%=rs2("monthofbirth")%>"> /
<input type="text" name="yearofbirth" size="14" value="<%=rs2("yearofbirth")%>"></p>
<p>Age:<br>
<input type="text" size="30" name="age" value="<%=rs2("age")%>"></p>
<p>&nbsp;</td>
<td width="50%" valign="top" align="center">E-Mail Address: <br>
<input type="text" size="30" name="email" value="<%=rs2("email")%>"><p>Country: <br>
<input type="text" size="30" name="country" value="<%=rs2("country")%>"></p>
<p>Contact Number: <br>
<input type="text" size="30" name="tel" value="<%=rs2("tel")%>"><br>
&nbsp;</td>
</tr>
</table>
<br>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="100%">
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<p style="text-align: left">Address:</p>
<blockquote>
<p style="text-align: left">
<textarea rows="10" cols="36" name="address"><%=rs2("address")%></textarea></p>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<p>&nbsp;</td>
</tr>
</table>

<p>

You're done. Just click the register button to continue.<p>

<input type="submit" value="Update" onClick="javascript:str_to_num(this.form)">
<input type="reset" value="Reset"> <input type="button" value="Cancel" name="B1" onclick="location.href('/mediaguidehome.asp')"></FORM>
</HTML>
Touch eyeballs to screen for cheap laser surgery
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,409
Reputation: goldeagle2005 is an unknown quantity at this point 
Solved Threads: 43
Team Colleague
goldeagle2005's Avatar
goldeagle2005 goldeagle2005 is offline Offline
Finkus Stinkalotus

Re: Error while trying the update query

 
0
  #2
Oct 20th, 2005
any ideas ppl?
Touch eyeballs to screen for cheap laser surgery
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC