相思资源网 Design By www.200059.com
<!--#include virtual="/include/conn.inc"-->
<%
'*********************************
'* classname: ADOXDBOPR
'* 制作人: 刘晓逸
'* 作用: 用adox进行数据库的操作
'* 版本: 1.0
'*www.jb51.net
'**********************************
Class ADOXDBOPR
dim objADOX
Private Sub Class_Initialize
Set objADOX=Server.CreateObject("ADOX.Catalog")
end sub
Public Property let Connection(objCONN)
objADOX.ActiveConnection=objCONN
End Property
public function arrTName
dim arrTNames()
dim i : i=1
for each objtab in objADOX.tables
if objtab.type="TABLE" then
redim Preserve arrTNames(i)
arrTNames(i-1)=objtab.name
i=i+1
end if
next
arrTName=arrTNames
end function
public function arrfinfo(szTName)
dim arrf()
Set objTAdox=objADOX.tables.item(szTName)
for i=0 to objTAdox.columns.count-1
Set dicInfo=Server.CreateObject("Scripting.Dictionary")
redim preserve arrf(i+1)
dicInfo.add "name",objTAdox.columns.Item(i).name
dicInfo.add "type",type_int2str(objTAdox.columns.Item(i).type)
Set arrf(i)=dicInfo
Set dicInfo=nothing
next
arrfinfo=arrf
end function
public sub del_table(szTName)
objADOX.tables.delete szTName
End Sub
public sub add_table(szTName)
Set obj_tab=Server.CreateObject("ADOX.Table")
obj_tab.Name=szTName
Set obj_tab.ParentCatalog=objADOX
objADOX.tables.Append obj_tab
Set obj_tab=nothing
End Sub
public sub delColumns(arrColumns,szTName)
Set obj_tab=objADOX.tables.item(szTName)
if isarray(arrColumns) then
for i=0 to ubound(arrColumns)
obj_tab.columns.delete arrColumns(i)
next
else
obj_tab.columns.delete arrColumns
end if
end sub
public sub add_columns(arrColumns,szTName)
Set objTab=objADOX.tables.item(szTName)
for i=0 to ubound(arrColumns)
objTab.columns.append arrColumns(i,0),arrColumns(i,1),arrColumns(i,2)
next
end sub
function type_int2str(int_value)
select case int_value
case 3:
type_int2str="数字"
case 202:
type_int2str="文本"
case else:
type_int2str=int_value
end select
end function
Private Sub Class_Terminate
Set objADOX=nothing
End Sub
End class
%>
<%
'*********************************
'* classname: ADOXDBOPR
'* 制作人: 刘晓逸
'* 作用: 用adox进行数据库的操作
'* 版本: 1.0
'*www.jb51.net
'**********************************
Class ADOXDBOPR
dim objADOX
Private Sub Class_Initialize
Set objADOX=Server.CreateObject("ADOX.Catalog")
end sub
Public Property let Connection(objCONN)
objADOX.ActiveConnection=objCONN
End Property
public function arrTName
dim arrTNames()
dim i : i=1
for each objtab in objADOX.tables
if objtab.type="TABLE" then
redim Preserve arrTNames(i)
arrTNames(i-1)=objtab.name
i=i+1
end if
next
arrTName=arrTNames
end function
public function arrfinfo(szTName)
dim arrf()
Set objTAdox=objADOX.tables.item(szTName)
for i=0 to objTAdox.columns.count-1
Set dicInfo=Server.CreateObject("Scripting.Dictionary")
redim preserve arrf(i+1)
dicInfo.add "name",objTAdox.columns.Item(i).name
dicInfo.add "type",type_int2str(objTAdox.columns.Item(i).type)
Set arrf(i)=dicInfo
Set dicInfo=nothing
next
arrfinfo=arrf
end function
public sub del_table(szTName)
objADOX.tables.delete szTName
End Sub
public sub add_table(szTName)
Set obj_tab=Server.CreateObject("ADOX.Table")
obj_tab.Name=szTName
Set obj_tab.ParentCatalog=objADOX
objADOX.tables.Append obj_tab
Set obj_tab=nothing
End Sub
public sub delColumns(arrColumns,szTName)
Set obj_tab=objADOX.tables.item(szTName)
if isarray(arrColumns) then
for i=0 to ubound(arrColumns)
obj_tab.columns.delete arrColumns(i)
next
else
obj_tab.columns.delete arrColumns
end if
end sub
public sub add_columns(arrColumns,szTName)
Set objTab=objADOX.tables.item(szTName)
for i=0 to ubound(arrColumns)
objTab.columns.append arrColumns(i,0),arrColumns(i,1),arrColumns(i,2)
next
end sub
function type_int2str(int_value)
select case int_value
case 3:
type_int2str="数字"
case 202:
type_int2str="文本"
case else:
type_int2str=int_value
end select
end function
Private Sub Class_Terminate
Set objADOX=nothing
End Sub
End class
%>
标签:
vbs,adox,数据库
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无vbs adox提取数据库表名和列名的类的评论...