一個功能完善的專欄管理的程序->這是asp.net的第二個應(yīng)用(三) /* 豆腐制作,都是精品 http://www.asp888.net 豆腐技術(shù)站 如轉(zhuǎn)載,請保留完整版權(quán)信息 */ 剛才說了一些題外話,現(xiàn)在我們來看看我們?nèi)绾螌⒃赼dd.aspx中輸入的數(shù)據(jù)保存在sql server中 <!--#include file="func.aspx"--> <% dim conn as SQLConnection dim sqlRead as SQLDataReader dim sqlCmd as SQLCommand '這樣我們通過 func.aspx 文件的使用,對連接代碼等等很多通用的程序進行了同意的管理和調(diào)用 conn=GetConn() dim strUserName as string dim strPass as string dim strSQL as string strUserName=request.form("txtUserid") strPass=request.form("txtPass") strSQL="select UserPassWord from lanmuuser where username='" & replaceSql(strUserName) & "'"
sqlCmd=new SQLCommand(strSQL,conn) sqlCmd.ActiveConnection.Open() sqlCmd.Execute(sqlRead) sqlCmd.ActiveConnection.Close() '這個部分是對 添加文章的用戶 進行 限制和管理 '在演示的版本中,這段代碼是 屏蔽起來的,如果我們需要對 用戶進行限制 '簡單的作個lanmuuser 的 table 就可以了 if not sqlRead.Read() then response.Write("這個用戶不存在") response.end end if if sqlRead(0)<>strPass then '密碼不正確 response.Write("密碼不正確") response.end end if '校驗合法 dim strClassid as string strClassid=request.form("selClass") dim strTitle as string strTitle=request.form("txtTitle") dim strContent as string strContent=request.form("txtContent") dim strSelFrom as string strSelFrom=request.form("selFrom") strSQL="insert into lanmu(classid,title,content,dtime,userid,IsUse,viewnum,selFrom)values(" strSQL=strSQL & "" & strClassId & ",'" & replaceSql(strTitle) & "','" & replaceSql(strContent) & "'," strSQL=strSQL & "getdate(),'" & replaceSql(strUserName) & "','0',0,'" & strSelFrom & "')"