Ask a Question related to Coldfusion Database Access, Design and Development.
-
Student-Kav #1
SQlerror while updating/deleting
Hi Guys,
need ur help once agian.
This is my first file (updatedeleteuser.cfm) from where the user gets an
opiont to either select update or delete a reacod
<cfoutput query="selectall">
<tr>
<div align="center">
<td><div align="center">#memid#</div></td>
<td><div align="center">#username#</div></td>
<td><div align="center">#lastname# #firstname# #middlename#</div></td>
<td><div align="center"><a href="update.cfm?memid=#memid#">Update</a>
/ <a href="delete.cfm?memid=#memid#" onClick="return confirm('Are You Sure You
Want To Delete This Record?');">Delete</a></div></td>
</div>
</tr>
The update file is below:
<cfquery name="getmember" datasource="isaca">
SELECT
username,password,firstname,middlename,lastname,ha ddr1,haddr2,hcity,hstate,hzipc
ode,phone,hemail,company,designation,caddr1,caddr2 ,ccity,cstate,czipcode,cemail
FROM usertable
WHERE memid = '#URL.memid#'
</cfquery>
</head>
<body bgcolor="#BEBEBE" background="../transparent.gif">
<p> </p>
<table width="900" height="240" border="0" align="center" cellpadding="0"
cellspacing="0" id="table2">
<tr>
<td height="16" bgcolor="#BEBEBE"> </td>
</tr>
<tr>
<td height="103" bgcolor="#999999"><div align="center"><img
src="../ISACALogo.gif" width="800" height="122"></div></td>
</tr>
<tr>
<td height="49" bgcolor="#BEBEBE"><div align="center">
<h3 class="style1"><font face="Verdana, Arial, Helvetica,
sans-serif"><u>Add User</u></font></h3>
</div></td>
</tr>
</table>
<form action="updatedone.cfm" method="post">
<cfoutput>
<table align="center" >
<tr>
<td>User Name</td>
<td><input type="text" value="#getmember.username#" name="uname"> </td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" value="#getmember.password#" name="pass"> </td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" value="#getmember.firstname#" name="fname"></td>
</tr>
<tr>
<tr>
<td>Middle Name</td>
<td><input type="text" value="#getmember.middlename#" name="mname"></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" value="#getmember.lastname#" name="lname"></td>
</tr>
<tr>
<td>Home Address 1</td>
<td><input type="text" value="#getmember.haddr1#" name="haddr1"></td>
</tr>
<tr>
<tr>
<td>Home Address 2</td>
<td><input type="text" value="#getmember.haddr2#" name="haddr2"></td>
</tr>
<tr>
<tr>
<td>Home City</td>
<td><input type="text" value="#getmember.hcity#" name="hcity"></td>
</tr>
<tr>
<td>Home State</td>
<td><input type="text" value="#getmember.hstate#" name="hst"></td>
</tr>
<tr>
<td>Home Zipcode</td>
<td><input type="text" value="#getmember.hzipcode#" name="hzip"></td>
</tr>
<tr>
<td>Personal Email</td>
<td><input type="text" value="#getmember.hemail#" name="pemail"></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input type="text" value="#getmember.phone#" name="pnumber"></td>
</tr>
<td>Company Name</td>
<td><input type="text" value="#getmember.company#" name="cname"></td>
</tr>
<tr>
<td>Designation</td>
<td><input type="text" value="#getmember.designation#" name="desig"></td>
</tr>
<tr>
<td>Company Address 1</td>
<td><input type="text" value="#getmember.caddr1#" name="caddr1"></td>
</tr>
<tr>
<tr>
<td>Company Address 2</td>
<td><input type="text" value="#getmember.caddr2#" name="cadddr2"></td>
</tr>
<tr>
<tr>
<td>Company City</td>
<td><input type="text" value="#getmember.ccity#" name="ccity"></td>
</tr>
<tr>
<td>Company State</td>
<td><input type="text" value="#getmember.cstate#" name="cst"></td>
</tr>
<tr>
<tr>
<td>Company Zipcode</td>
<td><input type="text" value="#getmember.czipcode#" validate="zipcode"
required="no" name="czip"></td>
</tr>
<tr>
<tr>
<td>Company Email</td>
<td><input type="text" value="#getmember.cemail#" name="cemail"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit"></td>
</tr>
</table>
</form>
</cfoutput>
IT gives me the follwing error
Error Occurred While Processing Request
Error Diagnostic Information
ODBC Error Code = 22005 (Error in assignment)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
The error occurred while processing an element with a general identifier of
(CFQUERY), occupying document position (24:1) to (24:45).
Date/Time: 11/07/05 15:30:01
Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12)
Gecko/20050915 Firefox/1.0.7
Remote Address: 129.1.24.42
HTTP Referrer: [url]http://129.1.23.120/mba/mbasa/admin/updatedeleteuser.cfm[/url]
Query String: memid=1
please help in soliving this, would hihgly apprecite it.
thanks,
kavin mehta
Student-Kav Guest
-
updating and deleting from cart
Does anyone have any good examples of how to update and delete items from a shopping cart. I'm using an Array to hold the items in the cart. I... -
#14254 [Com]: SQLERROR -439
ID: 14254 Comment by: shai at shai dot org Reported By: cedric dot boudin at iconmedialab dot com Status: ... -
db2dart and SQLERROR
HI all, some days ago i've ask infos about db2dart use. Now, i've tried to run db2dart <dbname> /DB on my Linux server (running db2 7.1... -
[PHP] deleting one cookie is deleting both..why? (tiny scripts)
--- Ryan A <ryan@jumac.com> wrote: If you are setting the cookie from bestwebhosters.com, the best way (my opinion) is to not specify the domain,... -
WHENEVER SQLERROR does'nt always work
On 26 Jun 2003 05:09:48 -0700, ni4ni@hotmail.com (Guy) wrote: Why catch parsing errors? Your scripts are static aren't they? Just correct the... -
jdeline #2
Re: SQlerror while updating/deleting
It would appear that memid is numeric, and is defined that way in the database. If that's the case, change WHERE memid = '#URL.memid#' to WHERE memid = #URL.memid#
jdeline Guest
-
Student-Kav #3
Re: SQlerror while updating/deleting
well that did solve the problem but now I have another one;
after the update it goes to updatedone.cfm which is as below:
<cfquery name="UpdateRecord" datasource="isaca">
UPDATE usertable
SET memid = #form.memid#,
username = '#form.uname#',
password = '#form.pass#',
role = #form.role#,
firstname = '#form.fname#',
middlename = '#form.mname#',
lastname = '#form.lname#',
haddr1= '#form.haddr1#',
haddr2= '#form.haddr2#',
hcity= '#form.hcity#',
hstate= '#form.hst#',
hzipcode= #form.hzip#,
phone= '#form.pnumber#',
hemail= '#form.pemail#' ,
company= '#form.cname#',
designation= '#form.desig#',
caddr1= '#form.caddr1#',
caddr2= '#form.caddr2#',
ccity= '#form.ccity#',
cstate= '#form.cst#',
czipcode= #form.czip# ,
cemail= '#form.cemail#'
WHERE ID = #form.memid#
</cfquery>
<cfquery name="getrecord" datasource="isaca">
SELECT *
FROM EmployeeDirectory
WHERE ID = #form.memid#
</cfquery>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Update User</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#BEBEBE">
<table width="900" height="240" border="0" align="center" cellpadding="0"
cellspacing="0" id="table2">
<tr>
<td height="16" bgcolor="#BEBEBE"> </td>
</tr>
<tr>
<td height="103" bgcolor="#999999"><div align="center"><img
src="../ISACALogo.gif" width="800" height="122"></div></td>
</tr>
<tr>
<td height="49" bgcolor="#BEBEBE"><div align="center">
<h3 class="style1"> </h3>
</div></td>
</tr>
</table>
<h2 align="center">Record Updated Succesfully</h2>
<h3 align="center">The Record Details are:</h3>
<table align="center">
<cfoutput query="getrecord">
<tr>
<td>Member ID</td>
<td>#memid#</td>
</tr>
<tr>
<td>User Name</td>
<td>#username#</td>
</tr>
<tr>
<td>Firstname</td>
<td>#firstname#</td>
</tr>
<tr>
<td>Middle Name</td>
<td>#middlename#</td>
</tr>
<tr>
<td>Last Name</td>
<td>#lastname#</td>
</tr>
<tr>
<td>Home Address 1</td>
<td>#haddr1#</td>
</tr>
<tr>
<td>Home Address 2</td>
<td>#haddr2#</td>
</tr>
<tr>
<td>Home City</td>
<td>#hcity#</td>
</tr>
<tr>
<td>Home Zipcode</td>
<td>#hzipcode#</td>
</tr>
<tr>
<td>Personal Email </td>
<td>#hemail#</td>
</tr>
<tr>
<td>Phone Number</td>
<td>#phone#</td>
</tr>
<tr>
<td>Company Name</td>
<td>#company#</td>
</tr>
<tr>
<td>Designation</td>
<td>#designation#</td>
</tr>
<tr>
<td>Company Address 1</td>
<td>#caddr1#</td>
</tr>
<tr>
<td>Company Address 2</td>
<td>#caddr2#</td>
</tr>
<tr>
<td>Company City</td>
<td>#ccity#</td>
</tr>
<tr>
<td>Company Zipcode</td>
<td>#czipcode#</td>
</tr>
<tr>
<td>Company Email</td>
<td>#cemail#</td>
</tr>
</cfoutput>
<!--- Output the record --->
</table>
<p align="center"><a href="admin_main.cfm">Go To Main Admin Page</a></p>
</body>
</html>
Now the problem is if I run this peice of code I get the follwoing eror
Error Occurred While Processing Request
Error Diagnostic Information
ODBC Error Code = 07001 (Wrong number of parameters)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Hint: The cause of this error is usually that your query contains a reference
to a field which does not exist. You should verify that the fields included in
your query exist and that you have specified their names correctly.
The error occurred while processing an element with a general identifier of
(CFQUERY), occupying document position (32:1) to (32:45).
Date/Time: 11/07/05 16:38:53
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Remote Address: 129.1.24.42
HTTP Referrer: [url]http://129.1.23.120/mba/mbasa/admin/update.cfm?memid=15[/url]
I dont get it as to y is it so....
Student-Kav Guest
-
jdeline #4
Re: SQlerror while updating/deleting
I'd start by taking the error message literally. Did you mispell a field name?
Are you putting quotes around a numeric value.
A suggestion. If you are going to post long pieces of code, place them in the
"Attach Code" section and indent appropriatelly. It makes ia a lot easier
follow your logic. Also, the error message refers to the CFQUERY at line 32.
Post the 5-line code fragment that CF provides that shows the line numbers.
jdeline Guest
-
CF_Oracle #5
Re: SQlerror while updating/deleting
If you are going to update your PK (memid = #form.memid#), then pass as hidden
form variable original memid and put it in WHERE clause:
where memid = #form.orig_memid#).
Usually it's not a good idia to update PK. The other solution could be if you
will not update memid and pass it as form or URL variable, then just remove
fist line memid = #form.memid# and leve it in WHERE.
CF_Oracle Guest



Reply With Quote

