| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2470 人关注过本帖
标题:本地练习ASP链接数据库发生错误,但不知是什么意思
只看楼主 加入收藏
无忧当当
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-7-9
结帖率:100%
收藏
 问题点数:0 回复次数:10 
本地练习ASP链接数据库发生错误,但不知是什么意思
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。

相关说明:
1.系统Windows XP SP2;
2.IIS版本6.0;
3.数据库是Office Access;
4.网页制作媒介是Dreamweaver CS3。


先谢谢了。
搜索更多相关主题的帖子: 数据库 Dreamweaver Microsoft 网页制作 ASP 
2008-07-09 10:51
fuhuijun
Rank: 1
等 级:新手上路
帖 子:407
专家分:0
注 册:2007-10-30
收藏
得分:0 
是不是没有权限啊,把你的代码贴出来
2008-07-09 10:53
无忧当当
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-7-9
收藏
得分:0 
一共三个界面:新闻列表、新闻详细查看、添加新闻。
1、新闻列表:list.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/gonggao.asp" -->
<%
Dim rs1
Dim rs1_cmd
Dim rs1_numRows

Set rs1_cmd = Server.CreateObject (")
rs1_cmd.ActiveConnection = MM_gonggao_STRING
rs1_ = "SELECT gonggaoid, title, addtime FROM gonggao ORDER BY gonggaoid DESC"
rs1_cmd.Prepared = true

Set rs1 = rs1_cmd.Execute
rs1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 15
Repeat1__index = 0
rs1_numRows = rs1_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {font-size: 9pt; font-family: "宋体"; }
.STYLE4 {
    color: #FF0000;
    font-weight: bold;
}
-->
</style>
<link href="../main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="845" height="134" colspan="9"><img src="../images/logo.png" alt="" name="logo" width="845" height="134" id="logo" /></td>
  </tr>
  <tr align="center" valign="middle" bordercolor="#C4B9AA" bgcolor="#C4B9AA">
    <td height="24"><span class="STYLE3"><a href="../index.html" class="url_1">首页</a></span></td>
    <td><span class="STYLE3">班委会</span></td>
    <td><span class="STYLE3">团支部</span></td>
    <td><span class="STYLE3">互动专区</span></td>
    <td bgcolor="#C4B9AA"><span class="STYLE3"><a href="../wenjian/list.asp" class="url_1">班级文件</a></span></td>
    <td><span class="STYLE3">班级公告</span></td>
    <td><span class="STYLE3">友邻班级</span></td>
    <td><span class="STYLE3">教师专栏</span></td>
    <td><span class="STYLE3">关于我们</span></td>
  </tr>
  <tr align="center" valign="middle">
    <td height="24" colspan="9" align="left" class="STYLE3">你的位置 &gt;&gt; <span class="STYLE4">班级公告</span></td>
  </tr>
</table>

<%
While ((Repeat1__numRows <> 0) AND (NOT rs1.EOF))
%>
  <table width="844" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="337" class="STYLE2"><strong>标题</strong></td>
      <td width="376" class="STYLE2"><strong>发布时间</strong></td>
    </tr>
    <tr>
      <td class="STYLE2"><a href="read.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "gonggaoid=" & rs1.Fields.Item("gonggaoid").Value %>" target="_blank" class="url_2"><%=(rs1.Fields.Item("title").Value)%></a></td>
      <td class="STYLE2"><%=(rs1.Fields.Item("addtime").Value)%></td>
    </tr>
  </table>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rs1.MoveNext()
Wend
%>
<p>&nbsp;</p>
</body>
</html>
<%
rs1.Close()
Set rs1 = Nothing
%>
2008-07-09 10:56
无忧当当
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-7-9
收藏
得分:0 
2、新闻详细查看:read.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/gonggao.asp" -->
<%
Dim rs2__MMColParam
rs2__MMColParam = "1"
If (Request.QueryString("gonggaoid") <> "") Then
  rs2__MMColParam = Request.QueryString("gonggaoid")
End If
%>
<%
Dim rs2
Dim rs2_cmd
Dim rs2_numRows

Set rs2_cmd = Server.CreateObject (")
rs2_cmd.ActiveConnection = MM_gonggao_STRING
rs2_ = "SELECT * FROM gonggao WHERE gonggaoid = ?"
rs2_cmd.Prepared = true
rs2_cmd.Parameters.Append rs2_cmd.CreateParameter("param1", 5, 1, -1, rs2__MMColParam) ' adDouble

Set rs2 = rs2_cmd.Execute
rs2_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>班级公告</title>
<style type="text/css">
<!--
.STYLE3 {font-size: 9pt; font-family: "宋体"; }
.STYLE4 {
    color: #FF0000;
    font-weight: bold;
}
.url_menu {
    font-family: "宋体";
    font-size: 9pt;
    color: #000000;
    text-decoration: none;
}
-->
</style>

<link href="../main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE20 {
    font-size: 16pt;
    font-weight: bold;
}
.STYLE21 {
    font-size: 12
}
-->
</style>
</head>

<body>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="845" height="134" colspan="9"><img src="../images/logo.png" alt="" name="logo" width="845" height="134" id="logo" /></td>
  </tr>
  <tr align="center" valign="middle" bordercolor="#C4B9AA" bgcolor="#C4B9AA">
    <td height="24"><span class="STYLE3"><a href="../index.html" class="url_menu">首页</a></span></td>
    <td><span class="STYLE3">班委会</span></td>
    <td><span class="STYLE3">团支部</span></td>
    <td><span class="STYLE3">互动专区</span></td>
    <td><span class="STYLE3">班级文件</span></td>
    <td><span class="STYLE3"><a href="list.asp" class="url_1">班级公告</a></span></td>
    <td><span class="STYLE3">友邻班级</span></td>
    <td><span class="STYLE3">教师专栏</span></td>
    <td><span class="STYLE3">关于我们</span></td>
  </tr>
  <tr align="center" valign="middle">
    <td height="24" colspan="9" align="left" class="STYLE3">你的位置 &gt;&gt; <span class="STYLE2"><a href="list.asp" class="url_1">班级公告</a> &gt;&gt;</span><span class="STYLE4"> 详细查看</span></td>
  </tr>
  <tr align="center" valign="middle">
    <td height="24" colspan="9" align="left" class="STYLE3">&nbsp;</td>
  </tr>
  <tr align="center" valign="middle">
    <td height="24" colspan="9" align="left" class="STYLE3">&nbsp;</td>
  </tr>
</table>
<table width="845" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" class="STYLE2 STYLE20"><%=(rs2.Fields.Item("title").Value)%></td>
  </tr>
  <tr>
    <td align="center" class="STYLE2 STYLE20">&nbsp;</td>
  </tr>
  <tr>
    <td class="STYLE21"><%=(rs2.Fields.Item("content").Value)%></td>
  </tr>
  <tr>
    <td align="right" class="STYLE21">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="STYLE21">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="STYLE21"><%=(rs2.Fields.Item("author").Value)%>    <%=(rs2.Fields.Item("addtime").Value)%></td>
  </tr>
</table>
<p>&nbsp;</p>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0"><tr align="center" valign="middle"></tr>
</table>
</body>
</html>
<%
rs2.Close()
Set rs2 = Nothing
%>
2008-07-09 10:57
无忧当当
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-7-9
收藏
得分:0 
3、添加:addgonggao.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/gonggao.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject (")
    MM_editCmd.ActiveConnection = MM_gonggao_STRING
    MM_ = "INSERT INTO gonggao (title, author, addtime, content) VALUES (?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("title")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("author")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("addtime")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, Request.Form("content")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "../gonggao/list.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
Dim rs3
Dim rs3_cmd
Dim rs3_numRows

Set rs3_cmd = Server.CreateObject (")
rs3_cmd.ActiveConnection = MM_gonggao_STRING
rs3_ = "SELECT title, content, author, addtime FROM gonggao"
rs3_cmd.Prepared = true

Set rs3 = rs3_cmd.Execute
rs3_numRows = 0
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {font-size: 9pt; font-family: "宋体"; }
.STYLE4 {
    color: #FF0000;
    font-weight: bold;
}
.url_menu {
    font-family: "宋体";
    font-size: 9pt;
    color: #000000;
    text-decoration: none;
}
-->
</style>
<link href="main.css" rel="stylesheet" type="text/css" />
<link href="../main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p class="STYLE4">当前位置:添加公告</p>
<form ACTION="<%=MM_editAction%>" METHOD="POST" id="form1" name="form1">
  <table width="606" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="88" class="STYLE2">公告标题</td>
      <td width="518" class="STYLE2"><label>
        <input name="title" type="text" id="title" size="50" />
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2">发布者</td>
      <td class="STYLE2"><label>
        <input name="author" type="text" id="author" size="20" />
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2">发布时间</td>
      <td class="STYLE2"><label>
        <input name="addtime" type="text" id="addtime" size="15" />
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2">内容</td>
      <td class="STYLE2"><label>
        <textarea name="content" cols="40" rows="6" id="content"></textarea>
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2">&nbsp;</td>
      <td class="STYLE2">&nbsp;</td>
    </tr>
    <tr>
      <td class="STYLE2">&nbsp;</td>
      <td class="STYLE2"><label>
        <input type="submit" name="button" id="button" value="提交" />
      </label>
        <label>
        <input type="reset" name="button2" id="button2" value="重置" />
      </label></td>
    </tr>
  </table>

  

  

  

  

  <input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp; </p>
</body>
</html>
<%
rs3.Close()
Set rs3 = Nothing
%>
2008-07-09 10:57
无忧当当
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-7-9
收藏
得分:0 
谁能解答一下啊!!!!5555555555555我都快急死了
2008-07-09 14:34
towering
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:261
专家分:507
注 册:2007-10-9
收藏
得分:0 
代码没有问题
你放文件的硬盘是NTFS分区吧?
要是的话可以设置一下访问权限就可以了。
2008-07-09 16:56
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
检查数据库文件权限。
2008-07-09 17:06
无忧当当
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2008-7-9
收藏
得分:0 
还是不行,能不能具体说说权限的问题
2008-07-09 17:10
towering
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:261
专家分:507
注 册:2007-10-9
收藏
得分:0 
右键你的数据库文件,
选择“属性”,
再选择“安全”
再选择“添加”
再选择“高级”
再选择“立刻查找”
找到“Everyone”

添加就可以了
2008-07-09 17:56
快速回复:本地练习ASP链接数据库发生错误,但不知是什么意思
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019467 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved