如何在IIS服务器里面打开带有SQL数据库的ASP程序

sleilei 2002-09-17 12:41:07
我想在IIS个人服务器上试运行一个带有SQL数据库的ASP程序,可惜程序不能运转,请问各位高手大哥,这是什么毛病??我是个女孩,希望能得到帮助,
(通过服务器中转)
...全文
77 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
qimangxing 2002-09-17
  • 打赏
  • 举报
回复
另:你不说你是女孩,大家也会帮你的。




顺便问一下,是不是ppmm呀?
qimangxing 2002-09-17
  • 打赏
  • 举报
回复
看来是你打开数据库连接的代码有错,试着把conn.asp改成下面这样,其中的ip地址和数据库名称,账号、密码改成你自己的就好了:
conn.asp
<%
'跟据实际情况修改相应代码以联接相就数据库
set conn=server.CreateObject("ADODB.CONNECTION")
'SQL server
ds="DRIVER=SQL Server;SERVER=11.11.11.1;User Id=sa;PASSWORD=;DATABASE=sxhr"
'Access
'ds="driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("dc.mdb")
conn.Open ds
%>
awaysrain 2002-09-17
  • 打赏
  • 举报
回复
conn.asp的代码
sleilei 2002-09-17
  • 打赏
  • 举报
回复
<!-- #include file="conn.asp" -->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from poll where id="&request.querystring("id")
rs.open sql,conn,1,1
if not rs.eof then
dim polltitle,polluser,pollvalue1,pollvalue2,pollvalue3,pollvalue4,pollstart,pollstop
polltitle=trim(rs("polltitle"))
polluser=trim(rs("polluser"))
pollvalue1=trim(rs("pollvalue1"))
pollvalue2=trim(rs("pollvalue2"))
pollvalue3=trim(rs("pollvalue3"))
pollvalue4=trim(rs("pollvalue4"))
pollstart=trim(rs("pollstart"))
pollstop=trim(rs("pollstop"))
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<html>
<head>
<title><%=polltitle%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body bgcolor="#f2f2f2" text="#000000">
<form name="form1" method="post" action="pollsave.asp?id=<%=request.querystring("id")%>">
<div align="center">
<table width="400" border="0" cellspacing="0" cellpadding="0" height="20" bgcolor="#000099">
<tr>
<td>
<div align="center"><font color="#ffffff"><b><%=trim(polltitle)%></b></font></div>
</td>
</tr>
</table>
<table width="400" border="0" cellspacing="0" cellpadding="0" height="20">
<tr>
<td>该投票由<font color="#ff0000"><%=trim(polluser)%></font>发起,开始于<font color="#ff0000"><%=trim(pollstart)%></font>,<%if isnull(trim(pollstop))<>true then%>将于<%=trim(pollstop)%>结束。<%else%>没有设置结束时间。<%end if%></td>
</tr>
</table>
<table width="399" border="0" cellspacing="0" cellpadding="0" height="25" bgcolor="#FFFFFF">
<tr>
<td width="50">
<input type="radio" name="pollvaluenum" value="1">
</td>
<td width="349"><%=trim(pollvalue1)%></td>
</tr>
</table>
<table width="400" border="0" cellspacing="0" cellpadding="0" height="25" bgcolor="#E0E0E0">
<tr>
<td width="50">
<input type="radio" name="pollvaluenum" value="2">
</td>
<td width="350"><%=trim(pollvalue2)%></td>
</tr>
</table>
<table width="400" border="0" cellspacing="0" cellpadding="0" height="25" bgcolor="#FFFFFF">
<tr>
<td width="50">
<input type="radio" name="pollvaluenum" value="3">
</td>
<td width="350"><%=trim(pollvalue3)%></td>
</tr>
</table>
<table width="400" border="0" cellspacing="0" cellpadding="0" height="25" bgcolor="#E0E0E0">
<tr>
<td width="50">
<input type="radio" name="pollvaluenum" value="4">
</td>
<td width="350"><%=trim(pollvalue4)%></td>
</tr>
</table>
<br>
<input type="submit" name="Submit" value="投票">
<input type="submit" name="submit" value="查看">
</div></form>
<p align="center"> </p>
<div align="center">
<p> </p>
<p><br>
</p>
</div>
<p align="center">
<!-- #include file="copyright.asp" -->
</p>
fbj007 2002-09-17
  • 打赏
  • 举报
回复
你连接数据库的代码?
sleilei 2002-09-17
  • 打赏
  • 举报
回复
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
/conn.asp, 第 3 行
谢谢各位好心的大哥
错误是上面这样的
iStringTheory 2002-09-17
  • 打赏
  • 举报
回复
不能运行?系统报什么错?是不是500-100服务器内部错误?
hjbwt 2002-09-17
  • 打赏
  • 举报
回复
如果你的IIS配置没有问题,必须打开ie,通过地址栏输入url地址,进行访问,asp服务器才会对你的程序解释执行,直接双击是不行的,如果不是这个问题,把你的错误贴出来,让大家帮你想个办法.
xjbx 2002-09-17
  • 打赏
  • 举报
回复
报什么样的错?
lbf2002 2002-09-17
  • 打赏
  • 举报
回复
sleilei (雷磊) 你好:
打开INTERNET服务管理器,点击默认WEB站点,点鼠标右键选择新建下的虚拟目录,按您想要的建好后,假如您建的是aaa虚拟目录,然后选择你新建的虚拟目录,点鼠标右键选择属性,再选择其中的文档项,将里面的默认文档修改为你想要的文档名称,然后就用http://localhost/aaa/ASP文档名称,就可以打开了,如果想要建站点,那么同上,只要在新建的时候选择站点,其它步骤基本一样!在程序无误下应该要以用了!
不知道我说的详细吗!你试试吧!:)
MeXP 2002-09-17
  • 打赏
  • 举报
回复
配置iis,通过url既是类似这样(http://localhost/test.asp)来运行.asp的文件,不能通过双击打开。再一个不能运转,有可能程序有错误

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧