1.添加odbc數據源
![](https://img-blog.csdnimg.cn/img_convert/60a5dddf01a6fb8ae62be6f746c64f13.png)
2.添加dsn
![](https://img-blog.csdnimg.cn/img_convert/b6d5cb03c13ca21d4092dcce1f99eb9d.png)
3.配置dsn
![](https://img-blog.csdnimg.cn/img_convert/6eda77881bd34e833d26e1f4dc19ad15.png)
4.測試連接
tns為服務名
![](https://img-blog.csdnimg.cn/img_convert/9a93d2e39084b71d7ef994ffd197847d.png)
5.添加數據庫連接配置
<%
set conn=server.createobject("adodb.connection")
conn.ConnectionTimeout = 1000
conn.CommandTimeout = 2000
conn.Open "DSN=myweb;UID=lin;PWD=lin123;"
%>
6.代碼連接
<!-- #include file="./lib/conn.inc"-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>Demo</title>
</head>
<body>
<table>
<tr>
<td>頁面測試</td>
<td>
<select name="user_name" id="user_name" value="">
<%
sql=" select * from MY_CSV "
set rs = conn.execute(sql)
if not rs.eof then
do while not rs.eof
%>
<option value="<%=rs("A")%>"><%=rs("A")%></option>
<%
rs.movenext
loop
end if
%>
</select>
</td>
</tr>
</table>
</body>
</html>
![](https://img-blog.csdnimg.cn/img_convert/0c9de17479367e9f3621fc9904bffbca.png)
版权声明:本文为weixin_73368873原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。