home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cool Page Magazine 16
/
CoolPage_16.iso
/
dynadb
/
codes
/
addnew2.cfm
< prev
next >
Wrap
Text File
|
1997-12-03
|
3KB
|
103 lines
<!---------------------------└╔ªWíGAddnew2.cfm--------------------->
<!--- │o¼Oñ@¡╙½ß│B▓z╡{ªí --->
<!--- Ñ╗¡╢¼Oªb┐ΘñJ╝╞¡╚ÑH½ß│B▓z¬║╣L╡{ --->
<!--- ½e¡▒ñjÑb│í│ú¼Oªb┤·╕╒⌐╥┐ΘñJ¬║╕Ω«╞¼Oº_Ñ┐╜T --->
<!----------------------------------------------------------------->
<HEAD><TITLE>╖s╝W╕Ω«╞</TITLE></HEAD>
<BODY background="paper12l.jpg">
<HTML>
<!--- ▒N┼▄╝╞▒╥⌐lñ╞ --->
<cfset iserror=false> <!--- ¿M⌐wª│¿Sª│┐∙╗~╡oÑ═¬║┼▄╝╞ --->
<cfset dupidx=false> <!--- ¿M⌐w│f¬½╜s╕╣ª│¿Sª│¡½┬╨¬║┼▄╝╞ --->
<cfset id_long=false> <!--- ¿M⌐w│f¬½╜s╕╣ª│¿Sª│╣L¬°¬║┼▄╝╞ --->
<cfset name_long=false> <!--- ¿M⌐w│f¬½ªW║┘ª│¿Sª│╣L¬°¬║┼▄╝╞ --->
<cfset out_id="">
<cfset out_name="">
<cfset out_quantity=0>
<cfset out_cost=0>
<cfset out_ftype=''>
<!--- └╦¼d│f¬½╜s╕╣ª│¿Sª│¡½╜╞ --->
<CFQUERY NAME="Checkidx" DATASOURCE="Dynamic Database">
select * from product where prod_id = '#prod_id#'
</CFQUERY>
<cfif #Checkidx.recordcount# greater than 0>
<!--- ªp¬G╝╞╛┌¬φñññwª│░O┐²íA½h╢╟ª^ #Checkidx.recordcount# ¼░ 1,
¿Sª│░O┐²½h╢╟ª^ 0íAª]¼░ñ@¡╙ prod_id Ñu»αª│ñ@¡╙░O┐² --->
<cfset iserror=true>
<cfset dupidx=true>
<cfelse>
<cfset out_id=#prod_id#>
<cfset out_quantity=#quantity#>
<cfset out_cost=#cost#>
</cfif>
<cfif len(#prod_id#) greater than 10>
<!--- └╦¼d┐ΘñJ─µª∞¬║ñσªr¼Oº_╣L¬° --->
<cfset iserror=true>
<cfset id_long = true>
<cfelse>
<cfset id_long =false>
<cfset out_id=#prod_id#>
</cfif>
<cfif len(#product_name#) greater than 30>
<!--- └╦¼d┐ΘñJ─µª∞¬║ñσªr¼Oº_╣L¬° --->
<cfset iserror=true>
<cfset name_long = true>
<cfelse>
<cfset name_long =false>
<cfset out_name=#product_name#>
</cfif>
<cfif iserror>
┐ΘñJñúÑ┐╜TíCºAÑ╟ñFÑHñU┐∙╗~íG<br>
<cfif id_long>
│f¬½╜s╕╣ñ╙¬°íC╜╨ñ┼┐ΘñJ╢W╣L 10 ¡╙ªrª∞¬║╜s╕╣íC<br>
</cfif>
<cfif name_long>
│f¬½ªW║┘ñ╙¬°íC╜╨ñ┼┐ΘñJ╢W╣L 30 ¡╙ªrª∞¬║│f¬½ªW║┘íC<br>
</cfif>
<cfif dupidx>
│f¬½╜s╕╣¡½╜╞<br>
</cfif>
<cfelse>
<!--- ªp¬G│q╣LñF⌐╥ª│¬║┤·╕╒íA┤N╖|¿╙¿∞│oñ@│íñ└ --->
<CFQUERY NAME="GetType" DATASOURCE="Dynamic Database">
select * from prodtype where type_name = '#type#'
</CFQUERY>
<cfoutput query="GetType">
<cfset out_type='#type_code#'>
</cfoutput>
<!------------------------------------------------------------------------->
<!--- ÑHñU│oñ@¼q¼O╝╨╖╟¬║ SQL Ñy¬kíAÑ╬ÑH╖s╝Wñ@¡╙░O┐²íC --->
<!--- Ñy¬k¼░ insert into [table name] (fieldname1, fieldname2...) --->
<!--- values (field1_value, field2_value...) --->
<!------------------------------------------------------------------------->
<CfQuery name="AddRecord" datasource="dynamic database">
insert into product (prod_id, product_name, quantity, cost, type)
values ('#out_id#', '#out_name#', #out_quantity#, #out_cost#, '#out_type#')
</cfquery>
<!-------------------------SQL¬║Ñy¬k¿∞│o╕╠╡▓º⌠----------------------------->
<CENTER><H2>ºA¡Φñ~⌐╥┐ΘñJ¬║╕Ω«╞ñw╖s╝Wª▄╝╞╛┌«wññ</H2></CENTER>
<HR>
<P ALIGN="center"><A HREF="/dynadb/index.htm">ª^¿∞ÑD¡╢</A></P>
</cfif>
</BODY>
</HTML>