| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1341 人关注过本帖
标题:SOS紧急,高手请入
只看楼主 加入收藏
heida0907
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-11-7
结帖率:0
收藏
已结贴  问题点数:15 回复次数:8 
SOS紧急,高手请入
我的网站ACCESS数据库中的一个表再往里面添加记录的时候,从后台只能添加六条记录,如果手动在数据里写的话,前台也只能提取这几条记录,而且只能对这六条记录进行修改和删除
用select 语句查询时可以看到手写插入表中的内容,可能是什么原因造成的呢
搜索更多相关主题的帖子: SOS 
2009-11-07 16:42
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:7 
代码怎么写的?
2009-11-07 16:46
heida0907
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-11-7
收藏
得分:0 
这段是添加记录的代码Sub SaveAdd()
    sql="insert into cnk_Article"
    sql=sql&" (ChannelID,title,author,fromwhere,Keywords,Description,content)"
    sql=sql&" values ("&ChannelID&",'"&title&"','"&author&"','"&fromwhere&"','"&PageKeywords&"','"&PageDescription&"','"&content&"')"
    conn.execute(sql)
    Call alertmsg_url("添加成功","Article.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang)
End Sub
2009-11-07 16:53
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:7 
明显你发的代码是不可能看出问题所在的
2009-11-07 17:01
heida0907
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-11-7
收藏
得分:0 
能加我QQ吗632021041
2009-11-07 17:04
heida0907
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-11-7
收藏
得分:0 
上边逼的比较急,我一时又分析不出来哪错了
2009-11-07 17:07
heida0907
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-11-7
收藏
得分:0 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="opendb.asp" -->
<%
Call CheckAdmin()
'Call CnkAdminRight(1)

Dim ShowLang
ShowLang=Trim(Request("ShowLang"))
if ShowLang<>"" then ShowLang=Clng(ShowLang) else ShowLang=Lang

thispage=request("page_code")
if thispage="" then
    thispage=1
else
    thispage=clng(thispage)
end if
if thispage<1 then thispage=1
PagePara="?ChannelID="&ChannelID&"&ShowLang="&ShowLang

Dim Action,Language,title,author,fromwhere,imagename,PageKeywords,PageDescription,outlink,content,id
'Dim newflag,recommend,ReadRight

Action=Trim(Request("Action"))
'Language=Trim(Request.Form("Language"))
title=Trim(Request.Form("title"))
author=Trim(Request.Form("author"))
fromwhere=Trim(Request.Form("fromwhere"))
'imagename=Trim(Request.Form("imagename"))
PageKeywords=Trim(Request.Form("PageKeywords"))
PageDescription=Trim(Request.Form("PageDescription"))
'outlink=Trim(Request.Form("outlink"))
content=Trim(Request.Form("content"))
content=replace(content,"'","""")
id=Trim(Request("id"))
'newflag=Trim(Request.Form("newflag"))
'recommend=Trim(Request.Form("recommend"))
'ReadRight=Trim(Request.Form("ReadRight"))
Call Head()
%>
<script language="javascript">
function  save_onclick()
{
  document.form1.content.value=editor.HtmlEdit.document.body.innerHTML;
  return true;
}

function cform(){
 if(!confirm("您确认删除吗? 请注意删除后无法恢复!"))
 return false;
}
</script>
<body>
<div class="cnkbox">
  <% =GetChannelContent(ChannelID,"ChannelName")%>
  管理导航: <a href="?ChannelID=<%= ChannelID %>">文章管理首页</a> | <a href="?ChannelID=<%= ChannelID %>&Action=Add">添加新文章</a></div>
<%
select case Action
case "saveadd"
    Call SaveAdd()
case "savemodi"
    Call SaveModi()
case "del"
    Call AdminRight("DelAdmin",ChannelID,session("admin"))
    Call del()
case ""
%>
<div class="cnkbox">
  <div class="title">
    <% =GetChannelContent(ChannelID,"ChannelName")%>
    文章/新闻管理</div>
  <% If Lang=2 Then %>
  <a href="?ChannelID=<%=ChannelID%>">显示全部</a> <!--| <a href="?ChannelID=<%'=ChannelID%>&ShowLang=0">只显示中文</a> | <a href="?ChannelID=<%'=ChannelID%>&ShowLang=1">只显示英文</a>-->
  <% End If %>
  <% Dim ipage
      sql="select id,title,initime from cnk_Article where ChannelID="&ChannelID
      if ShowLang<>2 then sql=sql&" and Lang="&ShowLang
      sql=sql&" order by initime desc"
      rs.open sql,conn,1,3
      if not rs.eof and not rs.bof then
      'if rs.recordcount=0 then
      'Response.Write "未有内容"
      'Response.end
     ' else
        rs.pagesize=20
        if thispage>rs.pagecount then thispage=rs.pagecount
        rs.AbsolutePage = thispage
    %>
  <table width="96%" border="0" cellpadding="3" cellspacing="1">
    <tr bgcolor="#C2E0FE" align="center">
      <td width="17%">时间</td>
      <td width="58%">标题</td>
      <td width="12%" align="center">修改</td>
      <td width="13%" align="center">删除</td>
    </tr>
    <% for ipage=1 to rs.pagesize%>
    <tr bgcolor="#F6F6F6"  onMouseOut="mOut(this,'#F6F6F6');" onMouseOver="mOvr(this,'#EBFFBB');">
      <td><%=rs("initime")%> </td>
      <td>
        <%' If rs("Lang")=0 Then Response.Write("中") Else Response.Write("英")%>
         <a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&Action=modi"><%=rs("title")%>&nbsp;</a></td>
      <td align="center"><a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&ShowLang=<%= ShowLang %>&Action=modi">修改</a></td>
      <td align="center"><a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&ShowLang=<%= ShowLang %>&Action=del"  onclick="return cform()">删除</a></td>
    </tr>
    <%rs.movenext
      if rs.eof then exit for
      next%>
  </table>
  <table width="96%" height="21" border="0" background="images/bg-xg.gif" bgcolor="#EFEFEF">
    <tr>
      <td width="50%"><% = GetPageList(rs.pagecount,thispage,PagePara,0) %></td>
      <td width="50%" align="right"> 共 <strong><%=rs.recordcount%></strong> 条
        <% = GetPage(rs.pagecount,thispage,PagePara,0) %></td>
    </tr>
  </table>
  <% rs.close
        set rs=nothing
        End If %>
</div>
<% Case "Add"
Call AdminRight("AddAdmin",ChannelID,session("admin"))%>
<form name="form1" method="post" action="Article.asp" onSubmit="return save_onclick()">
  <div class="cnkbox">
    <div class="title">
      <% =GetChannelContent(ChannelID,"ChannelName")%>
      添加文章</div>
    <div class="content">
      <div id="list">
       <!-- <ul>
          <li class="t1">选择语言:</li>
          <li class="t2">
            <%' If Lang=0 or Lang=2 Then %>
            <input type="radio" name="Language" value="0" id="Lang1" checked="checked" />
            <label for="Lang1">中文</label>
            <%' End If %>
            <%' If Lang=1 or Lang=2 Then %>
            <input type="radio" name="Language" value="1" id="Lang2" <%' If Lang=1 Then Response.Write("checked=""checked""")%> />
            <label for="Lang2">EngLish</label>
            <% 'End If %>
          </li>
        </ul>-->
        <ul>
          <li class="t1">标题:</li>
          <li class="t2">
            <input name="title" type="text" class="input" id="title" size="30" maxlength="100" />
          </li>
        </ul>
        <!--<ul>
          <li class="t1">图片:</li>
          <li class="t2">
            <input name="imagename" type="text" class="input" id="imagename" value="http://" size="30" maxlength="100" />
            <input type="button" name="Submit2" value="上传" onClick="window.open('upload_flash.asp?formname=form1&editname=imagename&uppath=upfiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
            可用外部图片地址或上传图片 </li>
        </ul>-->
        <ul>
          <li class="t1">作者:</li>
          <li class="t2">
            <input name="author" type="text" class="input" id="author" size="30" maxlength="20" />
          </li>
        </ul>
        <ul>
          <li class="t1">来源:</li>
          <li class="t2">
            <input name="fromwhere" type="text" class="input" id="fromwhere" size="30" maxlength="20" />
          </li>
        </ul>
        <ul>
          <li class="t1">关键词:</li>
          <li class="t2">
            <input name="PageKeywords" type="text" class="input" id="PageKeywords" size="30" maxlength="255" />
            用逗号分隔,最多255字符 </li>
        </ul>
        <ul>
          <li class="t1">内容描述:</li>
          <li class="t2">
            <input name="PageDescription" type="text" class="input" id="PageDescription" size="30" maxlength="255" />
            用逗号分隔,最多255字符 </li>
        </ul>
     <!--   <ul>
          <li class="t1">外部链接:</li>
          <li class="t2">
            <input name="outlink" type="text" class="input" id="outlink" size="30" maxlength="255" />
            如填写本项,打开页面时将跳转到这个链接 </li>
        
        <ul>
          <li class="t1">重点图片:</li>
          <li class="t2">
            <input type="radio" name="newflag" value="1" id="newflag1">
            <label for="newflag1">是</label>
            <input name="newflag" type="radio" id="newflag2" value="0" checked>
            <label for="newflag2">否</label>
            (在调用代码时显示) </li>
        </ul>
        <ul>
          <li class="t1">推荐:</li>
          <li class="t2">
            <input type="radio" name="recommend" value="1" id="recommend1">
            <label for="recommend1">是</label>
            <input name="recommend" type="radio" id="recommend2" value="0" checked>
            <label for="recommend2">否</label>
            (在调用代码时显示) </li>
        </ul>
     
        <ul>
          <li class="t1">正文内容:</li>
          <li class="t2"> <font color="#FF0000">·换行请按Shift+Enter  ·另起一段请按Enter ·用|||设置分页符 </font><br />
            <textarea name="content" style="display:none"></textarea>
            <iframe ID="editor" src="editor.asp" frameborder=1 scrolling=no width="600" height="405"></iframe>
          </li>
        </ul>
        <br />
        <ul>
          <li class="t1">
            <input name="Action" type="hidden" id="Action" value="saveadd" />
            <input name="ChannelID" type="hidden" id="ChannelID" value="<%= ChannelID %>" />
            <input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" />
          </li>
          <li class="t2">
            <input name="提交" type="submit" class="button" value="提交" />
          </li>
        </ul>
        <div class="clearboth"></div>
      </div>
    </div>
  </div>
</form>
<% Case "modi"
Call AdminRight("ModiAdmin",ChannelID,session("admin"))
rs.open "select * from cnk_Article where id="&id,conn,1,3
%>
<form name="form1" method="post" action="Article.asp" onSubmit="return save_onclick()">
  <div class="cnkbox">
    <div class="title">
      <% =GetChannelContent(ChannelID,"ChannelName")&" -- "%>
      修改文章</div>
    <div class="content">
      <div id="list">
        <!--<ul>
          <li class="t1">选择语言:</li>
          <li class="t2">
            <% 'If Lang=0 or Lang=2 Then %>
            <input type="radio" name="Language" value="0" id="Lang1" <%' If rs("Lang")=0 Then Response.Write("checked=""checked""")%> />
            <label for="Lang1">中文</label>
            <%'End If %>
            <% 'If Lang=1 or Lang=2 Then %>
            <input type="radio" name="Language" value="1" id="Lang2" <% 'If rs("Lang")=1 Then Response.Write("checked=""checked""")%> />
            <label for="Lang2">EngLish</label>
            <% 'End If %>
          </li>
        </ul>-->
        <ul>
          <li class="t1">标题:</li>
          <li class="t2">
            <input name="title" type="text" class="input" id="title" value="<%= rs("title") %>" size="30" maxlength="100" />
          </li>
        </ul>
       <!-- <ul>
          <li class="t1">图片:</li>
          <li class="t2">
            <input name="imagename" type="text" class="input" id="imagename" value="<%'= rs("imagename") %>" size="30" maxlength="100" />
            <input type="button" name="Submit2" value="上传" onClick="window.open('upload_flash.asp?formname=form1&editname=imagename&uppath=upfiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
            可用外部图片地址或上传图片 </li>
        </ul>-->
        <ul>
          <li class="t1">作者:</li>
          <li class="t2">
            <input name="author" type="text" class="input" id="author" value="<%= rs("author") %>" size="30" maxlength="20" />
          </li>
        </ul>
        <ul>
          <li class="t1">来源:</li>
          <li class="t2">
            <input name="fromwhere" type="text" class="input" id="fromwhere" value="<%= rs("fromwhere") %>" size="30" maxlength="20" />
          </li>
        </ul>
        <ul>
          <li class="t1">关键词:</li>
          <li class="t2">
            <input name="PageKeywords" type="text" class="input" id="PageKeywords" value="<%= rs("Keywords") %>" size="30" maxlength="255" />
            用逗号分隔,最多255字符 </li>
        </ul>
        <ul>
          <li class="t1">内容描述:</li>
          <li class="t2">
            <input name="PageDescription" type="text" class="input" id="PageDescription" value="<%= rs("Description") %>" size="30" maxlength="255" />
            用逗号分隔,最多255字符 </li>
        </ul>
     <!--  <ul>
          <li class="t1">外部链接:</li>
          <li class="t2">
            <input name="outlink" type="text" class="input" id="outlink" value="<%'= rs("outlink") %>" size="30" maxlength="255" />
            如填写本项,打开页面时将跳转到这个链接 </li>
        </ul>
        <ul>
          <li class="t1">焦点:</li>
          <li class="t2">
            <input type="radio" name="newflag" value="1" id="newflag1" <%' If rs("newflag")=1 Then Response.Write("checked=""checked""")%>>
            <label for="newflag1">是</label>
            <input name="newflag" type="radio" id="newflag2" value="0" <%' If rs("newflag")=0 Then Response.Write("checked=""checked""")%>>
            <label for="newflag2">否</label>
            (在调用焦点时显示) </li>
        </ul>
        <ul>
          <li class="t1">推荐:</li>
          <li class="t2">
            <input type="radio" name="recommend" value="1" id="recommend1" <%' If rs("recommend")=1 Then Response.Write("checked=""checked""")%>>
            <label for="recommend1">是</label>
            <input name="recommend" type="radio" id="recommend2" value="0" <%' If rs("recommend")=0 Then Response.Write("checked=""checked""")%>>
            <label for="recommend2">否</label>
            (在调用推荐时显示) </li>
        </ul>
             <ul>
          <li class="t1">正文内容:</li>
          <li class="t2"> <font color="#FF0000">·换行请按Shift+Enter  ·另起一段请按Enter ·用|||设置分页符 </font><br />
            <textarea name="content" style="display:none"></textarea>
            <iframe ID="editor" src="editor.asp?table=cnk_Article&zd=content&id=<%= rs("id") %>" frameborder=1 scrolling=no width="600" height="405"></iframe>
          </li>
        </ul>
        <br />
        <ul>
          <li class="t1">
            <input name="Action" type="hidden" id="Action" value="savemodi" />
            <input name="id" type="hidden" id="id" value="<%= rs("id") %>" />
            <input name="ChannelID" type="hidden" id="ChannelID" value="<%= ChannelID %>" />
            <input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" />
          </li>
          <li class="t2">
            <input name="提交" type="submit" class="button" value="提交" />
          </li>
        </ul>
        <div class="clearboth"></div>
      </div>
    </div>
  </div>
</form>
<%
rs.close
End Select

Call Closedb()

Sub SaveAdd()
    sql="insert into cnk_Article"
    sql=sql&" (ChannelID,title,author,fromwhere,Keywords,Description,content)"
    sql=sql&" values ("&ChannelID&",'"&title&"','"&author&"','"&fromwhere&"','"&PageKeywords&"','"&PageDescription&"','"&content&"')"
    conn.execute(sql)
    Call alertmsg_url("添加成功","Article.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang)
End Sub

Sub SaveModi()
    sql="update cnk_Article set"
    sql=sql&" ChannelID="&ChannelID&",title='"&title&"',author='"&author&"',fromwhere='"&fromwhere&"',Keywords='"&PageKeywords&"',Description='"&PageDescription&"',content='"&content&"'where id="&id
    conn.execute(sql)
    Call alertmsg_url("修改成功","Article.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang)
End Sub

Sub del()
    conn.execute("delete from cnk_Article where id="&id)
    Call alertmsg_url("删除成功","Article.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang)
End Sub

%>这个是添加和修改文章调用的页面代码
2009-11-07 17:09
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
<%
select case Action
case "saveadd"
    Call SaveAdd()
case "savemodi"
    Call SaveModi()
case "del"
    Call AdminRight("DelAdmin",ChannelID,session("admin"))
    Call del()
case ""
%>
你的代码里SaveAdd只调用了一次?
2009-11-08 21:44
heida0907
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-11-7
收藏
得分:0 
每次更新数据时便会调用它啊,让我头疼的是,记录只能添加六个,六个之内可以更新,修改,删除等操作,
2009-11-08 21:52
快速回复:SOS紧急,高手请入
数据加载中...
 
   



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

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