Problem With Update Database

Problem with Update database

Page 1 of 1

1 Replies - 2832 Views - Last Post: 29 December 2004 - 02:24 AM Rate Topic: -----

#1 mahfuzkhan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 07-December 04

Problem With Update Database

Posted 27 December 2004 - 08:48 PM

Suppose I have two list box called UM and AM. UM holds the some information like a,b,d,e,g. AM also holds some fixed information like c,f,h,i,j. Note that, the information of AM will be come from another drop down list which holds group1,group2,... etc.; when I select like group1 then AM display like c,f,h,i,j .

User can add or delete any data from the AM list box. If now, I am add a,e,g in to the AM. When I press the button called Save Change then Only the data of AM will update.What's wrong in my code.

Please answer to me as early as possible.




[CODE]
query.cfm
--------------

<cfparam name="url.Id" default="0">
<cfparam name="url.result" default="">
<cfquery name="save" datasource="CMPM">
Update Module
Set ModuleName='<cfoutput>#url.result#</cfoutput>'
Where CustomerId=#url.Id#
</cfquery>
--------------------------

Mahfuz

Is This A Good Question/Topic? 0
  • +

Replies To: Problem With Update Database

#2 SpongeC  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 17-December 04

Re: Problem With Update Database

Posted 29 December 2004 - 02:24 AM

I didn't really understand how you are trying to do what you are trying to do, but looking at your code i found the possible bug.

Quote

Set ModuleName='<cfoutput>#url.result#</cfoutput>'


What you tried to do above is single-quote the parameter url.result
There is a much better way to do that!

Quote

Set ModuleName=<cfqueryparam cfsqltype="cf_sql_varchar" value="#url.result#">


The tag cfqueryparam handles the type of the query parameter so you don't need to worry about single-quotes, lists, nulls etc.

If for some reason you don't want to use cfqueryparam then you could also try to use function PreserveSingleQuotes(string). However, i would suggest on using PreserveSingleQuotes if you can't use cfqueryparam.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1