%@LANGUAGE="VBSCRIPT" CODEPAGE="950"%> <%Option explicit%> <% dim adocon,rs,Myself,reqaction,bsubmit,sqlstr dim msgtxt dim j,fArrAdd,vArr,tablename,fstr,vstr,keyfield,fieldType dim fieldDict,actionDest fArrAdd=array("b1","b2","b3","b4","b5",_ "c1","c2","c3","c4","c5","c6","c7","c8","c9","c10","c11","c12",_ "d1","d2","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","e1") fieldType=array("text","text","text","text","text",_ "chk","chk","chk","chk","chk","chk","chk","chk","chk","chk","chk","chk",_ "chk","chk","chk","chk","chk","chk","chk","chk","chk","chk","chk","chk","text") keyfield="id" tablename="form1" msgtxt="" Myself = Request.ServerVariables("PATH_INFO") set fieldDict=server.createobject("Scripting.Dictionary") set adocon=GetMdbConnection(DbLoc, DbPwd) reqaction=request.form("action") if reqaction<>"" then bsubmit=true else reqaction=request.querystring("action") bsubmit=false end if if reqaction="" then reqaction="add" select case reqaction case "add" actionDest="add_reg" case "add_reg" set fieldDict=Form2dict(fArrAdd) vArr=fieldDict.items for j=0 to ubound(vArr) if fieldType(j)="chk" then if vArr(j)="" then vArr(j)=0 else vArr(j)="'"&replace(vArr(j),"'","''")&"'" end if next fstr=keyfield&","&join(fieldDict.keys,",") vstr="'"&getSerialno(adocon,tablename,keyfield,6)&"',"&join(vArr,",") insertSql adocon,tablename,fstr,vstr msgtxt="Your Data has been submited." actionDest="add_reg" end select %>
<%=msgtxt%>
<%select case reqaction %>
<%case else%>
<%end select%>
|