数据库连接的问题,救命!
<%
on error resume next
dim conn
set conn=server.CreateObject( "ADODB.connection ")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ= " & Server.MapPath( "数据库试题.mdb ")
'conn.open "Provider=Microsoft.Jet.OLEDB.4.0;User Id=admin;Data Source= "& Server.MapPath( "数据库试题.mdb ")
set rsLogin=server.CreateObject( "adodb.recordset ")
sql= "select 用户名,密码,身份 from 用户表 "
rsLogin.open sql,conn,1,1
rsLogin.movefirst
user_name=rsLogin.field(0)
user_pwd=rsLogin.field(1)
user_identity=rsLogin.field(2)
%>
<script language= "javascript ">
alert ( <%=user_name%> );
alert ( <%=user_pwd%> );
alert ( <%=user_identity%> );
</script>
结果是三个对话框都是空的,我想应该是数据库连接有问题,但代码没错啊,数据源也设置了,有人说是temp文件夹的问题,我设置了everyone为可写入啊,但还是不行.还有那个用户表中是绝对有数据的
------解决方案--------------------两个变量能通用??
response.write user_name&user_pwd&user_identity& " <br> "
------解决方案-------------------- <script language= "javascript ">
alert ( " <%=user_name%> ");
alert ( " <%=user_pwd%> ");
alert ( " <%=user_identity%> ");
</script>
------解决方案--------------------on error resume next注释掉
在后面加上这段代码看看是什么问题再问
<%
if err.number <> 0 then
response.write err.description
end if
%>