请教!!
当我加上添加留言的各项后,我再点击留言的"发表留言"按钮,可我在留言的列表上不能马上看到刚加入的留言,只能再次打开留言后才看得到,我如想添加留言的各项后,点击留言的"发表留言"按钮就可在留言的列表上马上看到刚加入的留言,我该怎样改"发表留言"按钮代码啊???"发表留言"按钮的代码如下
<asp:button id="submit" onclick="Addnew_Subject_Submit" runat="server" Text="发表留言"></asp:button>
关键代码如下(bbs.aspx是显示留言列表文件)<script language="vb" runat="server">
sub page_load(sender as object,e as eventargs)
if session("username")="" then
response.redirect("bbs_login.aspx")
end if
end sub
sub Addnew_Subject_Submit(sender as object,e as eventargs)
    '=============上传图片===============================
dim i as integer
dim finfo as string
dim img as string
dim postedfile as httppostedfile=request.files(I)
'================================================
if postedfile.contentlength>0 then
dim filesplit() as string=split(postedfile.filename,"\")
dim filename as string=filesplit(filesplit.length-1)
postedfile.saveas(server.mappath("db\uploadfile")&"\"&filename)
dim imgpath as string ="db\uploadfile\"&filename
img="<img src="+imgpath+" border=0>"
end if
'=======================================提交文本信息==
dim mycommand as OLEDBcommand
    dim conn as OLEDBconnection
dim updatestring as string
dim subjectstr as string=subject.text
dim flage as string="subject"
   dim description as string=text1.text
   dim username as string=session("username")
  dim userhead as string=session("userhead")
   
   '================格式转换======================
    subjectstr=subjectstr.Replace("&","&amp;")
subjectstr=subjectstr.Replace("<","&lt;")
subjectstr =subjectstr.Replace(">","&gt;")
subjectstr =subjectstr.Replace(chr(32),"&nbsp;")
subjectstr =subjectstr.Replace("'","’")
subjectstr=subjectstr.Replace(chr(13),"<br>")
subjectstr=subjectstr.Replace(chr(10),"<br>")

'================格式转换======================
dim contentstr as string=content.text
    contentstr=contentstr.Replace("&","&amp;")
contentstr=contentstr.Replace("<","&lt;")
contentstr =contentstr.Replace(">","&gt;")
contentstr =contentstr.Replace(chr(32),"&nbsp;")
contentstr =contentstr.Replace("'","’")
contentstr=contentstr.Replace(chr(13),"<br>")
contentstr=contentstr.Replace(chr(10),"<br>")
'============
description=description.Replace("&","&amp;")
description=description.Replace("<","&lt;")
description =description.Replace(">","&gt;")
description=description.Replace(chr(32),"&nbsp;")
description=description.Replace("'","’")
description=description.Replace(chr(13),"<br>")


'=====================将转换后的字符串保存到数据库===
if username="" then
username="未知"
end if
updatestring="insert into content (subject,content,subdate,flage,subname,headimg,hitnum,replynum,img,imgdescription)values('"+subjectstr+"','"+contentstr+"',NOW(),'"+flage+"','"+username+"','"+userhead+"',0,0,'"+img+"','"+description+"')"
conn=new OLEDBconnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("db\bbs.mdb"))
    mycommand=new OLEDBcommand(updatestring,conn)
    conn.open()
    mycommand.executenonquery()
   response.redirect("bbs.aspx")
end sub
sub reset_form(sender as object,e as eventargs)
subject.text=""
content.text=""
end sub
</script>

解决方案 »

  1.   

    发表留言成功后加上这么一句:
    Response.Write("<script language=javascript>window.location.href=window.location.href;</script>");
      

  2.   

    to cancersyf(fengzhimei),你好,我把你给的这代码放在 response.redirect("bbs.aspx")后面,提示如下错误编译器错误信息: BC30648: 字符串常数必须以双引号结束。
    源错误:行 74:    
    行 75:   
    行 76: Response.Write("<script language=javascript>window.location.href=window.location.href;</script>");
    行 77: 
    行 78:    
     
    我把你给的这代码放在<asp:button id="submit" onclick="Addnew_Subject_Submit" runat="server" Text="发表这篇文章"></asp:button>后面,button没功能了和所有的添加留言的文本框不能写入文字了,我该怎么做啊??请大侠回一下啊.
      

  3.   

    to cancersyf(fengzhimei),你好,我把你给的这代码放在 response.redirect("bbs.aspx")后面,提示如下错误编译器错误信息: BC30648: 字符串常数必须以双引号结束。
    源错误:行 74:    
    行 75:   
    行 76: Response.Write("<script language=javascript>window.location.href=window.location.href;</script>");
    行 77: 
    行 78:    
     
    我把你给的这代码放在<asp:button id="submit" onclick="Addnew_Subject_Submit" runat="server" Text="发表这篇文章"></asp:button>后面,button没功能了和所有的添加留言的文本框不能写入文字了,我该怎么做啊??请大侠回一下啊.