?? tj2.asp
字號:
<% Option Explicit %>
<%
'如果上面的信息填全了,就添加記錄,否則給出錯誤信息
If Request.Form("標(biāo)題")<>"" And Request.Form("作者")<>"" And Request.Form("內(nèi)容")<>"" Then
'以下連上數(shù)據(jù)庫,建立一個Connection對象實例db
Dim db
Set db=Server.CreateObject("ADODB.Connection")
db.Open "Dbq="&Server.Mappath("0.mdb")&";Driver={Microsoft Access Driver (*.mdb)};"
'以下添加新記錄
Dim strSql,varName,varAuthor,varIntro '聲明幾個變量
varName=Request.Form("標(biāo)題")
varAuthor=Request.Form("作者")
varIntro=Request.Form("內(nèi)容")
StrSql="Insert Into "&request.Form("leibie")&"(標(biāo)題,作者,內(nèi)容,發(fā)表時間) Values('" & varName & "','" & varAuthor & "','" & varIntro & "',#" & Date() & "#)"
db.Execute(strSql)
Response.Redirect "bj.asp" '添加成功,則返回首頁
Else
Response.Write "請將所有信息填寫完整,"
Response.Write "<a href='tj.asp'>重新添加</a>"
End If
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -