熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

簡單asp+mssql server 留言板系統

2013-11-13 10:36:37  來源: .NET編程 

  數據庫教程連接程序

  sub opensql()
set sqlrs=serverCreateObject("adodbrecordset")
set sqlcn=servercreateobject("adodbconnection")
sqlconstr="driver={sql server};server=xiewen;uid=sa;pwd=;database=jimmy"
sqlcnopen sqlconstr
end sub

  //功能處理程序asp教程把內容保存到數據庫

  <%dim f_idtagnameslytxt
f_id=requestQueryString("id")
tag=requestQueryString("tag")
lytxt=html_encode(requestForm("lytxt"))
names=session("lyname")
if names="" then
 names="匿名"
end if
if (not isnumeric(f_id)) or (not isnumeric(tag)) or len(lytxt)< then
 responseWrite("<script language=javascript教程>alert(文章內容不能少於五個字符!);historyback();</script>")
else
 sql="select * from guestbook"
 on error resume next
 call opensql()
 sqlrsopen sqlsqlcn
 sqlrsaddnew
 sqlrs("ly")=lytxt
 sqlrs("f_id")=f_id
 sqlrs("tag")=tag
 sqlrs("name")=names
 sqlrsupdate
 if err= then
  responseRedirect("listasp?id="&f_id&"&tag="&tag)
 else
  responseWrite("<script language=javascript>alert(非常抱歉您的留言失敗!);historyback();</script>")
 end if
end if

  
%>

  html提供頁面

  <input name=lytxt >

  <input type=submit value提交 />

  
 


From:http://tw.wingwit.com/Article/program/net/201311/14112.html
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.