Solved

easy points,editing tables value,and access database

Posted on 2003-10-30
8
172 Views
Last Modified: 2013-12-24
hi ya

i have the following data, i would like the user to be able to change the carstatus in the table which will also update the database,can someone plz show me how to do it.
it doesnt matter how its done,either by radio buttons,text etc


<CFQUERY NAME="CarQuery" DATASOURCE="../dno/ser3">
  SELECT * FROM Cars
</CFQUERY>

<TABLE border="2" >
       <TR>
         <TH> Car ID </HT>
         <TH> Car_Status </HT>
       </TR>
     <CFOUTPUT QUERY="CarQuery">  
       <TR align="left">
        <TD>#CarQuery.CarID#</TD>
        <TD>#CarQuery.Car_Status#</TD>
       </TR>
     </CFOUTPUT>
</table>
0
Comment
Question by:evo14sale
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 17

Expert Comment

by:anandkp
ID: 9655818
give the user a form to edit the car status like

<CFQUERY NAME="CarQuery" DATASOURCE="../dno/ser3">
  SELECT * FROM Cars
</CFQUERY>

<TABLE BORDER="2" >
    <FORM NAME="frm" ACTION="updatestatus.cfm" METHOD="post">
     <TR>
       <TH> Car ID </HT>
       <TH> Car_Status </HT>
     </TR>
   <CFOUTPUT QUERY="CarQuery">  
     <TR ALIGN="left">
        <TD>#CarQuery.CarID#<INPUT TYPE="Hidden" NAME="carid" VALUE="#CarQuery.CarID#"></TD>
        <TD><INPUT NAME="carstatus" VALUE="#CarQuery.Car_Status#"></TD>
     </TR>
   </CFOUTPUT>
    </FORM>
</TABLE>

<!--- updatestatus.cfm --->

<CFIF ISDEFINED('CARSTATUS') & LEN(TRIM(CARSTATUS))>
    <CFQUERY NAME="Qry_Update" DATASOURCE="Dsn">
       Update mytable
         set carstatus = <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#carstatus#">
         where carid = <CFQUERYPARAM CFSQLTYPE="cf_sql_numeric" VALUE="#carid#">
   </CFQUERY>
</CFIF>

<CFLOCATION URL="updatedone.htm" ADDTOKEN="No">

HTH

K'Rgds
Anand

PS : I wonder - the same question was asked by someone ... else ?????????????
0
 

Author Comment

by:evo14sale
ID: 9655842
YEH THAT WAS ME,I JUST NEVA GOT NE REPLYS,WELL IF IT WORKS,ILL GIVE U BOTH POINTS IF U SAY THE RIGHT ANSWER
0
 

Author Comment

by:evo14sale
ID: 9655867
can u plz show me how to have a couple of radio buttons,so when i click on one,it will update the database.


ps i dont know wat u mean with this,wat is cfqueryparam?

<CFIF ISDEFINED('CARSTATUS') & LEN(TRIM(CARSTATUS))>
    <CFQUERY NAME="Qry_Update" DATASOURCE="Dsn">
       Update mytable
         set carstatus = <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#carstatus#">
         where carid = <CFQUERYPARAM CFSQLTYPE="cf_sql_numeric" VALUE="#carid#">
   </CFQUERY>
</CFIF>
0
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
LVL 17

Accepted Solution

by:
anandkp earned 120 total points
ID: 9655916
cfqueryparam is just a neat way of inserting/updating/deleting values from ur tables.

did u try teh example i posted - it hhas to work for sure

or if u r not able to understand it - show me what code u have & i'll modify it for u !

let em know

K'Rgds
Anand
0
 
LVL 4

Assisted Solution

by:procept
procept earned 120 total points
ID: 9656193
<cfqueryparam> actually makes queries more secure, and, sometimes faster.

For the radio buttons: name them all alike and give them different values:
<radio name="carstatus" value="status 1" checked> status 1<br>
<radio name="carstatus" value="status 2"> status 2<br>
<radio name="carstatus" value="status 3"> status 3<br>

Also, make sure that always one radio button is selected, or the variable will not be passed to the next page.

On your action page, #form.carstatus# will hold the value of the selected button.

HTH

Chris
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 9658861
> <cfqueryparam> actually makes queries more secure, and, sometimes faster.

Chris is right.  Use Query/Bind Params.  Most DBs are setup for statement caching.  If you don't use Bind Params, each query with a different value will come in as a new query.  If you use Bind Params each value is used and the statement/query is retreived from the DB cache.

CJ
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question