?? ch15-04-03.aspx
字號:
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDb" %>
<% Response.Expires = 0 %>
<Html>
<Head>
<Script Language="VB" Runat="Server">
' 在這里設置聯機字符串的內容
Dim DSN As String
Dim tSQL As String = "Select * From UserDatas"
Sub Page_Load(Obj As Object, e As EventArgs)
DSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("/ASP/Chap14/ASP.NET網頁數據庫.mdb") & ";"
ShowResultSet(DSN, tSQL)
End Sub
' 用戶單擊“更新”按鈕
Sub Button1_Click(Obj As Object, e As EventArgs)
Dim lRet As Boolean = False
tSQL = "UPDATE UserDatas Set "
tSQL = tSQL & "UserAccount='" & Request.Form("UserAaccount") & "',"
tSQL = tSQL & "UserPWD='" & Request.Form("UserPWD") & "'"
tSQL = tSQL & " WHERE UID = " & Request.Form("UserID")
Dim Counts As Integer
Counts = OpCommand(DSN, tSQL)
IF Counts > 0 Then' SQL語句執行成功
Response.Redirect("Ch15-04-03.aspx")
ELSE
Show1.InnerHtml = "數據操作命令執行失敗!"
END IF
End Sub
</Script>
<!-- #Include Virtual="/ASP/Chap15/ShowResultSet.inc" -->
<!-- #Include Virtual="/ASP/Chap15/OPCommand.inc" -->
</Head>
<Body>
<H2>更新用戶注冊信息</H2>
<Form Method="Post" Runat="Server">
輸入用戶編號:
<asp:TextBox ID="UserID" Runat="Server" /><BR>
登錄賬號:<asp:TextBox ID="UserAaccount" Runat="Server" /><BR>
密 碼:<asp:TextBox ID="UserPWD" TextMode="Password"
Runat="Server" /><BR>
<asp:Button ID="Button1" Text="更新"
OnClick="Button1_Click" Runat="Server" />
<Span ID="Show1" Runat="Server" />
</Form>
</Body>
</Html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -