電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫_第1頁
電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫_第2頁
電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫_第3頁
電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫_第4頁
全文預覽已結束

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫

電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫

1用asp動態(tài)生成與數(shù)據(jù)庫進行數(shù)據(jù)溝通的操作表單:form.asp:生成表單域頭:生成一般文本:生成密碼文本:生成滾動文本:生成單選:生成復選:生成列表框:生成提交按鈕生成重填按鈕生成表單域尾3.2用php動態(tài)生成與數(shù)據(jù)庫進行數(shù)據(jù)溝通的操作表單:form.php生成表單域頭:?生成一般文本:?生成密碼文本:?生成滾動文本:?生成單選:?生成復選:?生成列表框:網(wǎng)絡數(shù)據(jù)庫asp技術php技術jsp技術網(wǎng)站設計?生成提交按鈕?生成重填按鈕?生成表單域尾?3.3用jsp動態(tài)生成與數(shù)據(jù)庫進行數(shù)據(jù)溝通的操作表單form.jsp生成表單域頭:生成一般文本:生成密碼文本:生成滾動文本:生成單選:生成復選:生成列表框:生成提交按鈕生成重填按鈕生成表單域尾4設計用于存儲商務網(wǎng)站交互數(shù)據(jù)的mysql數(shù)據(jù)庫4.1啟動mysql數(shù)據(jù)庫服務器(mysql的安裝及odbc驅動程序的安裝與設置請參閱相關書籍)可在nt5.0下用啟動服務法/net命令法/命令窗口鍵入mysqld-shareware法,啟動mysql數(shù)據(jù)庫服務器,啟動數(shù)據(jù)庫服務器后,在d:\mysql\bin提示符下鍵入mysql-h-uroot即可消失mysql提示符,從這開頭即可進行對mysql數(shù)據(jù)庫的各種操作。若要退出可鍵入quit/exit,若要關閉數(shù)據(jù)庫服務器,可在d:\mysql\bin提示符下鍵mysqladmin-urootshutdown4.2建立mysql數(shù)據(jù)庫在mysql數(shù)據(jù)庫的提示符mysql鍵入createdatabasetradedb;(或go)4.2.建立mysql數(shù)據(jù)庫表這里以商務網(wǎng)站中常用的幾種數(shù)據(jù)表為例,主要用到的數(shù)據(jù)表和生成數(shù)據(jù)表的sql代碼如下:(這里的數(shù)據(jù)表字段只要分別對應上述表單域對象即可實際操作,數(shù)據(jù)表統(tǒng)一用tablename表示)客戶登錄管理數(shù)據(jù)表createtableusers(idintnotnullauto_increment,usernamevarchar(30)notnull,passwordvarchar(20)notnull)客戶信息數(shù)據(jù)表createtableusermessage(usernamevarchar(30)notnull,emailvarchar(80)notnull,addressvarchar(120)notnull,faxvarchar(40)null,phonevarchar(40)notnull,cerreycardvarchar(50)notnull)客戶定購商品數(shù)據(jù)表createtablecatalog(productidintnotnull,namevarchar(64)notnull,pricefloat(6,2)notnull,descriptiontextnull)5設計處理表單數(shù)據(jù)的3p程序5.1設計處理表單數(shù)據(jù)的asp程序form_cl.asp建立與數(shù)據(jù)庫的連接:這里采納直接驅動法setconn=server.createobject(adodb.connection);conn.opendriver={mysql};server=localhost;uid=user;pwd=xxxxxx;database=tradedb獵取表單提交的數(shù)據(jù):data1=request(ptwbk);data2=request(mmwbk);data3=request(gdwbk)data4=request(dxk);data5=request(fxk);data6=request(lbk)用sql語句對數(shù)據(jù)庫進行操作查詢數(shù)據(jù)記錄:sql=select*fromtablename;setrs=conn.execute(sql)增加數(shù)據(jù)記錄:sql=insertintotablename(ptwbk,mmwbk,gdwbk,dxk,fxk,lbk)values(data1,data2,data3,data4,data5,data5);setrs=conn.execute(sql)更改某條數(shù)據(jù)記錄:sql=updatetablenamesetdata1=request(ptwbk),whereid=num;setrs=conn.execute(sql)刪除某條數(shù)據(jù)記錄:sql=deletefromtablenamewhereid=num;setrs=conn.execute(sql)將sql語句處理的數(shù)據(jù)結果輸出response.write

response.write

fori=0tors.fields.count-1response.write

rs.fields(i).name

nextresponse.write

whilenotrs.eofresponse.write

fori=0tors.fields.count-1response.write

rs.fields(i).value

nextresponse.write

rs.movenextwendresponse.write

關閉數(shù)據(jù)庫:rs.close;conn.close5.2設計處理表單數(shù)據(jù)的php程序form_cl.php建立與數(shù)據(jù)庫的連接:這里采納php的mysql函數(shù)法(也可用odbc函數(shù)法)$conn=odb

電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫

c_connect(localhost,user,xxxxxx);選擇數(shù)據(jù)庫:mysql_select_db(tradedb,$conn);獲去表單提交的數(shù)據(jù):$data1=$ptwbk;$data2=$mmwbk;$data3=$gdwbk;$data4=$dxk;$data5=$fxk;$data6=$lbk;用sql語句對數(shù)據(jù)庫進行操作查詢數(shù)據(jù)記錄:$sql=select*fromtablename;$result=odbc_do($conn,$sql);增加數(shù)據(jù)記錄:$sql=insertintotablename(ptwbk,mmwbk,gdwbk,dxk,fxk,lbk)values($data1,$data2,$data3,$data4,$data5,$data6);$result=odbc_do($conn,$sql);更改某條數(shù)據(jù)記錄:$sql=updatetablenameset$data1=ptwbkwhereid=num$result=odbc_do($conn,$sql);刪除某條數(shù)據(jù)記錄:$sql=deletefromtablenamewhereid=num;$result=odbc_do($conn,$sql);將sql語句處理的數(shù)據(jù)結果輸出odbc_result_all($result,border=1);關閉數(shù)據(jù)庫:odbc_close($conn);5.3設計處理表單數(shù)據(jù)的jsp程序form_cl.jsp建立與數(shù)據(jù)庫的連接:這里采納jdbc-odbc橋生成javabean法創(chuàng)建一個javabean命名為conndb.java,并保存在d:/resin1.1.3/doc/web-inf/classes/trade名目下,代碼如下:(限于篇幅這里沒按標準書寫,而采納不換行寫法,其他類同)packagetrade;importjava.sql.*;publicclassconndb{stringurl=jdbc:inetdae:localhost;stringlogin=user;stringpassword=xxxxxx;stringsdbdriver=sun.jdbc.odbc.jdbcodbcdriver;stringsconnstr=jdbc:odbc:dsnmysql;connectionconn=null;resultsetrs=null;publicconndb(){try{class.forname(sdbdriver);connectionconn=drivermanager.getconnection(url,login,password);}catch(java.lang.classnotfoundexceptione){system.err.println(conndb():+e.getmessage());}}public/resultset/executequery(string/sql)/{rs=null;try{conn=drivermanager.getconnection(sconnstr);statementstmt=conn.createstatement();rs=stmt.executequery(sql);}catch(sqlexceptionex){system.err.println(aq.executequery:+ex.getmessage());}returnrs;}}然后用javac編譯conndb.java生成與其同名目的conndb.class文件,在form_cl.jsp文件中加入如下標簽即可建立與數(shù)據(jù)庫的連接獲去表單提交的數(shù)據(jù):stringdata1=request.getparameter(ptwbk);stringdata2=request.getparameter(mmwbk)stringdata3=request.getparameter(gdwbk)stringdata4=request.getparameter(dxk)stringdata5=request.getparameter(fxk)stringdata5=request.getparameter(lbk)語句對數(shù)據(jù)庫進行操作查詢數(shù)據(jù)記錄:stringsql=select*fromtablename;connbean.executequery(sql);增加數(shù)據(jù)記錄:stringsql=insertintotablenamevalues(+data1+,+data2+,+data3+,+data4++,+data5+,+data6+);connbean.executequery(sql);更改某條數(shù)據(jù)記錄:stringsql=updatetablenamesetdata1=+ptwbk+,data2=+mmvbk+,data3=+gdwbk+whereid=+num+;connbean.executequery(sql)刪除某條數(shù)據(jù)記錄:stringsql=deletefromtablenamewhereid=+num+;connbean.executequery(sql);將sql語句處理的數(shù)據(jù)結果輸出resultsetrs=connbean.executequery(sql);while(rs.next()){out.print(+rs.getstring(ptwbk)+);out.print(+rs.getstring(mmvbk)+

電子商務網(wǎng)站平臺3p設計技術與網(wǎng)絡數(shù)據(jù)庫

);out.print(

+rs.getstring(gdwbk)+

);out.print(

+rs.getstring(dxk)+

);out.print(

+rs.getstring(fxk)+

);out.print(

+rs.getstring(lbk)+

);}關閉數(shù)據(jù)庫:rs.close();6三種電子商務網(wǎng)站設計技術綜述6.1主要特性:可見下表設計技術運行平臺服務器開發(fā)程序擴展組件aspwindows系列iisvbscript/jscript/perlactivexphpunix系列,novell,windowsapache等很多服務器phpfunctionjspunix系列,novell,windowsresin等很多服務器javajavabean6.2連接數(shù)據(jù)庫的方法:通過上述操作可看出,本文采納了三種操作mysql數(shù)據(jù)庫的方法,asp采納直接驅動法,php采納mysql函數(shù)法,jsp采納jdbc-odbc/javabean法6.3網(wǎng)站結構設計考慮篇幅,本文只給出了widows平臺上,電子商務網(wǎng)站設計中的

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論