国内程序转移至国外空间后,无法连接ACCESS数据库。已使用相对地址。请帮助。非常感谢。

fkys 2008-10-08 01:13:12
国内空间的asp代码正常,转移到国外空间(Lunarpages)后,无法连接数据库。

我弄了2个测试页。在本机(WINXP+IIS5)可以运行。但是在国外空间上(www.cjiitcn.net/cjmit/search.asp)

请您帮助。非常感谢。

本机测试查询页面:(search.asp 和 result.asp放在c:\inetpub\wwwroot\code下。数据库文件cjmit.mdb放在c:\inetpub\wwwroot\code\data下)

服务器上的测试文件和数据库文件关系与本机相同:search.asp和result.asp放在 根目录\httpdocs\cjmit下,cjmit.mdb放在 根目录\httpdocs\cjmit\data下。

查询页面:
search.asp
=============

'=============JS代码判断是否为空字符串
<script language="JavaScript">
<!--
function checkinput()
{
if (document.form1.gh.value=="")
{
alert("Please input your number");
document.form1.gh.focus();

return false;
}
return true;
}
-->
</script>
'======================查询表单
</font> </h2>
<h2>
<form name="form1" action="result.asp" method="get" onsubmit="return checkinput()" >
<span class="9p">Please input you number: </span> <font face="隶书" color="#0000FF">
<input type="text" name="gh">
<input type="submit" name="Submit" value="find out">
</font>
</form>
</h2>
<h2> <br>
</h2>

</table>
=====================

结果页面:
result.asp
====================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

'===============连接数据库==========
<%
mp="data/cjmit.mdb"
set db=server.createObject("ADODB.connection")
db.open "Provider=Microsoft.Jet.OLEDB.4.0;"& _
"Data Source=" & Server.MapPath(mp)

sql="select * from gj where gh="&request("gh")&""
set rs=db.execute(sql)

%>
'===============查询数据库===========
<% if rs.eof then %>
</h2>
<h3 align="center"> <font face="宋体" color="#000000">
<% response.write "Sorry. NO such number."%>
</font> </h3>
<% else %>

<table width="91%" border="2" align="center">
<tr>
<td width="56%" height="21"> <b>Number </b>: <%=rs("gh").value%> </td>
<td width="44%" height="21"> <b>Name </b>: <%=rs("zz").value%> </td>
</tr>
<tr>

<td colspan="2"> <b>Unit </b>: <%=rs("dw").value%> </td>
</tr>
<tr>
<td colspan="2"> <b>Topic </b>: <%=rs("tm").value%> </td>
</tr>
<tr>
<td width="56%" height="23"> <b>Status </b>: <%=rs("zt").value%> </td>
<td width="44%" height="23"> <b>Sum1 </b>: <%=rs("sgf").value%>元 </td>
</tr>
<tr>
<td width="56%" height="23"> <b>Data1 </b>: <%=rs("sgfdz").value%> </td>
<td width="44%" height="23"> <b>Data2 </b>: <%=rs("bmfsfrq").value%> </td>
</tr>
<tr>
<td width="56%" height="23"> <b>Sum2 </b>: <%=rs("bmf").value%>元 </td>
<td width="44%" height="23"> <b>Data3 </b>: <%=rs("bmfdzsj").value%> </td>
</tr>
<% end if %>
</table>
<br>

</body>
</html>
==========================
在国外空间输入数字后的错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


--------------------------------------------------------------------------------

Web Server at cjiitcn.net
...全文
262 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
fkys 2008-10-08
  • 打赏
  • 举报
回复
目前仍没有好的解决办法。
我正在将access转为mysql。
多谢各位的帮助。
fkys 2008-10-08
  • 打赏
  • 举报
回复
多谢。已联系国外空间,被告知支持access。
wronging 2008-10-08
  • 打赏
  • 举报
回复
关注ing
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 sy_binbin 的回复:]
还有!确定下这个服务器支持ACCESS不?


http://topic.csdn.net/u/20080216/11/8b76ba48-c313-4073-bc88-ed431e02ba60.html?1365297667

chinmo ,我厉害不,我竟然把这个帖子给找到了!哈哈
[/Quote]

呵呵,我都不记得有这一个帖子了

反正我记得有这几个原因在

  • 打赏
  • 举报
回复
呵呵,以前别人问的也可能是不支持ACCESS

国外的服务器有很多问题

与国内的不一样,因为国外大部分不采用ACCESS数据库的
sy_binbin 2008-10-08
  • 打赏
  • 举报
回复
还有!确定下这个服务器支持ACCESS不?


http://topic.csdn.net/u/20080216/11/8b76ba48-c313-4073-bc88-ed431e02ba60.html?1365297667

chinmo ,我厉害不,我竟然把这个帖子给找到了!哈哈
sy_binbin 2008-10-08
  • 打赏
  • 举报
回复
好像是数据库连接的驱动不对!

fkys 2008-10-08
  • 打赏
  • 举报
回复
明白。
确实是一个问题。
网站有望在几个月后改版。
不过这一段还是要用。

不知道国外之所以不开where的支持是为什么。
是因为安全问题?
  • 打赏
  • 举报
回复
ACCESS数据库就是麻烦在国外的服务器

如果是MSSQL就很少有这些问题
sy_binbin 2008-10-08
  • 打赏
  • 举报
回复
以前好像看见过加上where 条件就不行


fkys 2008-10-08
  • 打赏
  • 举报
回复
感谢chinmo的帮助。
我再等一等就结贴。

也欢迎各位朋友继续指点。
  • 打赏
  • 举报
回复
这个我也没想到好的方法,对于国外的服务器我没有用过,只是清楚有这些问题存在

fkys 2008-10-08
  • 打赏
  • 举报
回复
感谢chinmo朋友的指点。
是where语句的问题。去掉where后正常。
但是我确实需要限制查询条件。
不知道怎么修改?
请指点。
  • 打赏
  • 举报
回复
国外服务器有不少问题

一般有以下几种问题:

1。where的不支持,或者支持不好
2。是连接数据库的驱动可能和国内的不一样,需要改变
3.还有就是[]表名有些也不支持,会显示出错
4.就是路径的支持问题

你按这些问题去排除
fkys 2008-10-08
  • 打赏
  • 举报
回复
多谢。不知道我能更改一些国外数据库普遍接受的数据库读取方式?
fkys 2008-10-08
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 jhwcd 的回复:]
可能数据库没有可写权限,改成可写试试。
[/Quote]
多谢。我尽力修改。
  • 打赏
  • 举报
回复
国外服务器与国内有所不同,一些驱动可能不同,国外的系统一般为英文的
jhwcd 2008-10-08
  • 打赏
  • 举报
回复
可能数据库没有可写权限,改成可写试试。
fkys 2008-10-08
  • 打赏
  • 举报
回复
读数据的权限也要单独开通?
fkys 2008-10-08
  • 打赏
  • 举报
回复
但是我这个页面没有写入数据库。只是读数据库。
加载更多回复(3)

28,390

社区成员

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

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