概述
< % response.charset="gb2312"
tblname=request("tb")
dim objorasession,objoradb
dim strdbuser,strdbpwd,strdbconn
call connectdb()
sub connectdb() 连接数据库
on error resume next
strdbuser = "liujincai" 连接用户名
strdbpwd = "ljc1001" 用户密码
strdbconn = "hp1" 连接字符串
set objorasession = server.createobject("oracleinprocserver.xorasession")
set objoradb = objorasession.opendatabase(strdbconn,strdbuser & "/" & strdbpwd,0)
if err.number>0 then
response.write "错误 :" & err.description & ""
response.end
end if
end sub
sub enddb()
set objoradb = nothing
set objorasession = nothing
end sub
function gettablelist(str)
dim strsql,strtmp
dim objrs
strsql = "select at.table_name as tname,au.username as uname from all_tables at,all_users au where au.username=at.owner order by au.username"
set objrs = objoradb.dbcreatedynaset(strsql,0)
while not objrs.eof
stra = objrs("uname") & "." & objrs("tname")
if str=stra then
strtmp = strtmp & "" & stra & ""
else
strtmp = strtmp & "" & stra & ""
end if
objrs.movenext
wend
set objrs = nothing
gettablelist = strtmp
end function
% >
all tables : < %=gettablelist(tblname)% > (< %=strdbuser & "/" & strdbpwd & "@" & strdbconn% >) |
< %
if tblname<>"" then
strsql = "select * from " & tblname
set rs = objoradb.dbcreatedynaset(strsql,0)
response.write "
"for i=0 to rs.fields.count-1
response.write "
" & rs.fields(i).name & ""next
response.write "
"while not rs.eof
response.write "
"for i=0 to rs.fields.count -1
response.write "
" & rs.fields(i).value & ""next
response.write "
"rs.movenext
wend
set rs = nothing
end if
% >
细节可查询
http://www.jojoo.net/article/list.asp?id=4101
http://www.cx66.com/cxgzs/program/asp/581.htm
http://www.51one.net/info/1797.htm
http://www.kupage.com/webdesign/7/20031017/1641380000027pjtnjgy.htm
最后
以上就是英勇咖啡豆为你收集整理的asp连接oracle6,asp下用OracleInProcServer完成对Oracle的连接和操作-ASP教程,数据库相关...的全部内容,希望文章能够帮你解决asp连接oracle6,asp下用OracleInProcServer完成对Oracle的连接和操作-ASP教程,数据库相关...所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复