首页 美女贴图 网络日记 重庆租房 搜索指南 网络电视 飘网音乐 飘网博客 精彩网址 友情链接 飘网地图 本站留言
飘网中国
专题:网络营销 | 网站设计 | QQ技巧 | 搜索优化 | 菜鸟进阶 | 病毒攻防 | 网络技术 | 系统应用 | 本站作品 | 常用软件 | 工具软件 |
飘网中国>>网站设计>>正文

教程:ASP+SQL Server制作留言板的完整小例子

编辑:飘网 来源: 更新:2007-1-11 点击:
【字体:

摘要:教程:ASP+SQL Server制作留言板的完整小例子,写写关于SQL Server数据库的简单使用过程的教程,也算一个小总结!记录一些常用的方法,关键字,单词等,供以后查阅用!我们用ASP+SQL Server做个简单的留言板为例!
关键字:ASP SQL Server 留言板 
正文:
复的哪条记录,给回复者看

 output=output&rs("content")
 output=output&"<br><br>"
 
  sqlsub="select * from subFeedback where Feedback_ID="&rs("Feedback_ID")
  Set rsSub=Server.CreateObject("ADODB.Recordset")
  rsSub.open sqlSub,conn,1,3
  if not rsSub.eof then
  
    j=1   '为for语句定义变理
    do while not rsSub.eof 
  
     for k=1 to j            '贴子缩进,贴子越靠后,缩进量越大
      output=output&"  "
     next
   
    output=output&"["&j&"]楼<span style='word-wrap: break-word;'>"
    output=output&rsSub("content")
    output=output&"</span><br>"
    j=j+1
    rsSub.movenext
    loop
   end if
 output=output&"<br>"
 rs.movenext
 loop
response.write output
else
response.write "无记录!"
end if
rs.close
set rs=nothing
%>


<script>


function chkform(){
//这个函数用来判断输入是否为空
//当然这里的判断还远远不够,比仿说还要判断字符的多少,是否有非法字符等
if (document.add.title.value==""|| document.add.content.value==""){
alert("标题或内容不能为空,请输入!");
return;
}
document.add.action="add.asp";
document.add.submit;
}
</script>

<form name="add" method="post" action="javascript:chkfrom();">
标题<input type=text size="50" name=title><br>
内容<textarea name="content" cols="50" rows="8"></textarea><br>  
<input type="hidden" value="Feedback" name="table">
<!--上面是一个隐藏域,传递一个名为table,值为Feedback变量,让add.asp知道是编辑的Feedback表-->
<input type="submit" name=submit value="   提   交   ">
</form>
 
    通过上面的list.asp文件,这时如果数据库有有数据,那么网页中就可以显示数据了,如果没有内容网页显示“无记录”,下边显示增加表单。

3、创建Feedback.asp文件,用来填写留言的回复! 回复:<%=request("title")%>
<form name="add" method="post" action="add.asp">
内容<textarea name="content" cols="50" rows="8"></textarea><br>
<input type="hidden" name="table" value="subFeedback">  
<input type="hidden" name="Feedback_ID" value='<%=request.QueryString("Feedback_ID")%>'>
<input type="submit" name=submit value="   提   交   ">
</form> 


4、创建add.asp文件,用来分别保存时Feedback,subFeedback的两个表的增加记录!这里请注意ASP调用SQL SERVER的存储过程的方法,会让程序变的很简洁! <!--#include file="conn.asp"-->
<%
table=request.form("table")  '用来判断是编辑的
[1][2][3][4]
上一篇:ASP调用带参数存储过程的几种方式
下一篇:QQ本地密码验证破解,快来看密码破解!
最新文章 更多
推荐文章 更多
热门文章 更多
© 2005-2010 飘网中国 版权所有
站长邮箱:①LCC-749AT163.com ②FlymornATgmail.com(AT改为@)
如转载时,请注明出处;本站部分资源来自网络,如有侵权,请来信说明;飘易文章系统 HTML版.
渝ICP备05000119号