跳至內容
阿里BaBa電腦筆記
使用者工具
登入
網站工具
工具
顯示頁面
舊版
反向連結
最近更新
多媒體管理器
網站地圖
登入
最近更新
多媒體管理器
網站地圖
足跡:
asp:getdb
本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。
======方法一:取資資庫記錄到陣列中====== * 程式流程圖 * 原碼 <code asp 1> <!--#Include File="db_function.asp"--> Function getdb(fieldstr,comstr,fileNamet) '//getdb(資料庫欄位名稱(陣列型態),SQL命令,資料庫檔案位置) ReDim createUsers(0) : rlcnt = 0 getF1Ary = fieldstr Set conn=GetMdbConnection(fileNamet) '//搭配db_function 使用 Set rs1=GetSQLServerStaticRecordset(conn,comstr) '//搭配db_function 使用 dbcheck=false IF NOT rs1.EOF THEN FOR a1 = 1 TO rs1.RecordCount getSte = "" FOR gf1 = 0 TO Ubound(getF1Ary) getOne = getF1Ary(gf1) IF getSte="" THEN getSte = rs1(getOne) ELSE getSte = getSte & "<.>" & rs1(getOne) END IF NEXT IF createUsers(rlcnt)<>"" THEN rlcnt = rlcnt + 1 ReDim Preserve createUsers(rlcnt) END IF createUsers(rlcnt) = getSte rs1.Movenext NEXT else dbcheck=true END IF rs1.close() set rs1=nothing getdb=createUsers End Function </code> ======方法二:取單一欄位====== * 程式流程圖 * 原碼 <code asp 1> '只取單一欄紀錄 Function getDataConp(FieldName,cmdstr) '//getDataComp(欄位名稱,SQL指令) Set npf=server.createObject("ADODB.RECORDSET") npf.open cmdstr,copc,3,2 IF not npf.EOF THEN datavalue=npf(FieldName) END IF npf.close() getDataConp=datavalue End Function </code>
asp/getdb.txt
· 上一次變更: 2013/07/06 01:28 (外部編輯)
頁面工具
顯示頁面
舊版
反向連結
回到頁頂