|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
asp+版本简朴的留言板的制作(二) /* 豆腐制作,都是精品 http://www.asp888.net 豆腐技术站 如转载,请保留版权信息 */ 在留言的录入界面完成后,自然要预备做留言内容的录入了。这个其中一个很要害的地方就是如何将我们在config.web 的内容读取出来,我用了下面的几条语句 Dim Cfg as HashTable Cfg = Context.GetConfig("appsettings") Conn = New SQLConnection(cfg("Conn")) 这样就得到了我们在config.web 中设定的 连接串,程序如下 <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SQL" %> <script runat="server" language="VB"> Sub Page_Load(Src As Object, E As EventArgs) Dim conn As SQLConnection Dim Cfg as HashTable Cfg = Context.GetConfig("appsettings") Conn = New SQLConnection(cfg("Conn")) dim strSQL as string dim strNickName as string dim strMail as string dim strTitle as string dim strContent as string dim strIPAddr as string strNickName=replace(request.form("txtName"),"\\'","\\'\\'") strEmail=replace(request.form("txtMail"),"\\'","\\'\\'") strTitle=replace(request.form("txtTitle"),"\\'","\\'\\'") strContent=replace(request.form("txtContent"),"\\'","\\'\\'") strIPAddr=Request.ServerVariables ("REMOTE_ADDR") \\'用户IP地址 strSQL="insert into msgBoard(nickname,email,ipAddr,msgTime,msgTitle,msgContent)values(" strSQL=strSQL & "\\'" & strNickName & "\\',\\'" & strEMail & "\\',\\'" & strIPAddr & "\\',getdate(),\\'" & strTitle & "\\',\\'" & strContent & "\\')" response.write(strSQL) Dim Cmd As SQLCommand Cmd = New SQLCommand(strSQL,conn) Cmd.ActiveConnection.Open() Cmd.Execute() Cmd.ActiveConnection.Close() Response.Redirect("showmsg.aspx") end sub </script> 大家其实一看,就知道这段程序其实和asp的程序没有什么区别嘛,对了,跟着MS 的唯一的好处就是 他们在升级的时候总是对他们的以前的系统进行了很好的 兼容,除了因为引用了 ado.net 而使得数据库的操作 改变的比较多以外,其他的代码基本上都没有什么大的改变,糟糕 说道这里 就说错了一句话,不是没有什么大的改动,变化还是很大的,只不过对以前兼容了,我们这样的简朴的应用,好像也不会牵扯到什么复杂的改变的:) 返回类别: 教程 上一教程: Microsoft IIS 真的如此「不安全」吗?(3) 下一教程: WSH实用讲座---第三讲 创建邮箱 您可以阅读与"asp+版本简朴的留言板的制作(二)"相关的教程: · asp+版本简朴的留言板的制作(一) · ASP进阶教程Ⅷ:数据库版本的留言簿 · ASP教你制作简朴的留言簿 · 词语搭配游戏的制作(ASP)三 · 手把手教你用ASP制作留言本 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |