人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當(dāng)前位置:蘿卜系統(tǒng)下載站 > 技術(shù)開發(fā)教程 > 詳細(xì)頁面

VBS的數(shù)據(jù)庫設(shè)置類,

VBS的數(shù)據(jù)庫設(shè)置類,

更新時間:2022-06-27 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):

<!--
蛙蛙推薦:VBS的數(shù)據(jù)庫操作類,這個類實現(xiàn)了平時主要的數(shù)據(jù)庫操作,因為我們天天都在和數(shù)據(jù)庫打交道,有時候用這樣一個類也挺方便的,但是不知道實用性怎么樣,因為在性能和錯誤處理方面沒有做很多考慮,所以不知道它的通用性如何.
如果誰能再給這個類加上動態(tài)的錯誤處理的或者優(yōu)化一下性能,就更完美了.PS:做這個類也是為了練習(xí)一下VBS類的使用.
-->
<%
class classado
Private conn_c
Private rs_c
Public strconn
Private Sub Class_Initialize'定義類的初始化事件

End Sub

Private Sub Class_Terminate ' 設(shè)置 Terminate 事件。 '定義類的清空事件
rs_c.close
set rs_c=nothing
conn_c.close
set conn_c=nothing
End Sub

Public Function opendb() '打開數(shù)據(jù)庫
if isempty(strconn) then
response.Write("沒有設(shè)置數(shù)據(jù)庫連接字符串")
response.end
end if
if isempty(conn_c) then
Set conn_c=Server.CreateObject("ADODB.Connection")
conn_c.open strconn
else
response.Write("數(shù)據(jù)庫已經(jīng)打開了")
response.end
end if
End Function
Public Function getrs(ByVal strsql) '獲取記錄集
if isempty(conn_c) then
opendb()
end if

Set rs_c=Server.CreateObject("ADODB.RecordSet")
rs_c.Open strsql,conn_c,1,1
Set getrs=rs_c
End Function
Public Function exesql(ByVal strsql) '執(zhí)行一條sql語句,用來插入,更新,刪除記錄
if isempty(conn_c) then
opendb()
end if
conn_c.execute(strsql)
End Function
end class
%>
<%
'on error resume next '調(diào)試程序的時候請把此句去掉
strconn="Driver={sql server};server=192.168.0.110;database=northwind;uid=sa;pwd=sa;"
set c=new classado
c.strconn=strconn
c.opendb()
strsql="SELECT EmployeeID,TitleOfCourtesy + '' + LastName + '' + FirstName AS fullname FROM Employees"
arr_wawa=c.getrs(strsql).getrows()
set rs=c.getrs(strsql)
%>
<table width="100%" border="0" cellspacing="1">
<%
If not rs.eof Then
for i=0 to rs.fields.count-1
response.write rs.fields(i).name&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
next
response.write "<br>"
do while not rs.eof
for i=0 to rs.fields.count-1
response.write rs.fields(i).value&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
next
response.write "<br>"
rs.movenext
loop
end if
%>
<hr>

<table width="100%" border="0" cellspacing="1">
<% If not isempty(arr_wawa) Then %>
<% for i=0 to ubound(arr_wawa,2) %>
<tr>
<% for j=0 to ubound(arr_wawa,1) %>
<td><%= arr_wawa(j,i) %></td>
<% next %>
</tr>
<% next %>
<% Else %>
<tr>
<td>沒有記錄</td>
</tr>
<% End If %>




溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統(tǒng)下載排行

網(wǎng)站地圖xml | 網(wǎng)站地圖html
主站蜘蛛池模板: 贵港市| 汽车| 车致| 兰溪市| 宁明县| 丰城市| 万安县| 白山市| 法库县| 临夏市| 文昌市| 成安县| 越西县| 广德县| 马边| 于都县| 图木舒克市| 衢州市| 清远市| 深水埗区| 舟山市| 社旗县| 聂荣县| 页游| 教育| 贡山| 兴安盟| 建始县| 保康县| 琼海市| 通许县| 林西县| 麻阳| 长岭县| 剑河县| 佛冈县| 察哈| 陇川县| 修武县| 旬邑县| 宜州市|