做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

ASP.NET登錄注冊頁面實現(xiàn)

來源:懂視網(wǎng) 責編:小采 時間:2020-11-27 22:38:09
文檔

ASP.NET登錄注冊頁面實現(xiàn)

ASP.NET登錄注冊頁面實現(xiàn):如何利用Visual studio 2010創(chuàng)建一個ASP網(wǎng)站? 【文件】-->【新建】-->【網(wǎng)站】-->【ASP.Net網(wǎng)站】--【完成】 默認頁面Default.aspx 創(chuàng)建以上界面: <%@ Page Language=C# AutoEventWireup=true C
推薦度:
導讀ASP.NET登錄注冊頁面實現(xiàn):如何利用Visual studio 2010創(chuàng)建一個ASP網(wǎng)站? 【文件】-->【新建】-->【網(wǎng)站】-->【ASP.Net網(wǎng)站】--【完成】 默認頁面Default.aspx 創(chuàng)建以上界面: <%@ Page Language=C# AutoEventWireup=true C

如何利用Visual  studio 2010創(chuàng)建一個ASP網(wǎng)站?
【文件】-->【新建】-->【網(wǎng)站】-->【ASP.Net網(wǎng)站】--【完成】

默認頁面Default.aspx
創(chuàng)建以上界面:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserLogin.aspx.cs" Inherits="UserLogin" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
 <title></title> 
</head> 
<body> 
 <div align="center"> 
 <h1>用戶登錄頁面</h1> 
 <form id="form1" runat="server"> 
 <p> <asp:Label ID="lbusername" runat="server">用戶名:</asp:Label> 
 <asp:TextBox ID="tbusername" runat="server"></asp:TextBox> 
 </p> 
 
 <p> <asp:Label ID="lbpsw" runat="server">密 碼:</asp:Label> 
 <asp:TextBox ID="tbpsw" runat="server" TextMode="Password"></asp:TextBox> 
 </p> 
 <p><asp:Button ID="btnLogin" runat="server" Text="登錄" onclick="btnLogin_Click" /> 
 <asp:Button ID="btnCancel" runat="server" Text="取消" onclick="btnCancel_Click" /> 
 </p> 
 </form> 
 </div> 
</body> 
</html> 

登錄驗證功能

/// <summary> 
 /// 用戶登錄 
 /// </summary> 
 /// <param name="sender"></param> 
 /// <param name="e"></param> 
 protected void btnLogin_Click(object sender, EventArgs e) 
 { 
 if (tbusername.Text == "") 
 { 
 Response.Write(@"<script>alert('用戶名不能為空!');</script>"); 
 } 
 if (tbpsw.Text == "") 
 { 
 Response.Write(@"<script>alert('密碼不能為空!');</script>"); 
 } 
 string username = tbusername.Text; 
 string password = tbpsw.Text; 
 string sql = "select * from T_user where username=@username and password=@password"; 
 SqlParameter[] parameters = { new SqlParameter("@username",username), new SqlParameter("@password", password) }; 
 using (SqlConnection conn = new SqlConnection(connstr)) 
 { 
 conn.Open(); 
 using (SqlCommand cmd = conn.CreateCommand()) 
 { 
 cmd.CommandText = sql; 
 cmd.Parameters.AddRange(parameters); 
 DataSet ds = new DataSet(); 
 SqlDataAdapter adapter = new SqlDataAdapter(cmd); 
 adapter.Fill(ds); 
 DataTable table = ds.Tables[0]; 
 if(table != null) 
 Response.Write(@"<script>alert('登錄成功!');</script>"); 
 else 
 Response.Write(@"<script>alert('登錄失敗!');</script>"); 
 
 } 
 } 
 
 
 } 

注冊功能

/// <summary> 
 /// 用戶注冊 
 /// </summary> 
 /// <param name="sender"></param> 
 /// <param name="e"></param> 
 protected void brnRegister_Click(object sender, EventArgs e) 
 { 
 string username = tbusername.Text; 
 string password = tbpsw.Text; 
 string sql = "Insert into T_user(username, password) values(@username,@password)"; 
 SqlParameter[] parameters = { new SqlParameter("@username", username), new SqlParameter("@password", password) }; 
 using (SqlConnection conn = new SqlConnection(connstr)) 
 { 
 conn.Open(); 
 using (SqlCommand cmd = conn.CreateCommand()) 
 { 
 cmd.CommandText = sql; 
 cmd.Parameters.AddRange(parameters); 
 cmd.ExecuteNonQuery(); 
 } 
 } 
 
 Response.Write(@"<script>alert('注冊成功!');</script>"); 
 } 

知識點歸納:
1.如何創(chuàng)建一個ASP.Net網(wǎng)站
2. 使用服務器控件實現(xiàn)界面設計
3. 對數(shù)據(jù)庫的簡單操作

一個簡單的用戶注冊、登錄就完成了,通過這個案例希望對大家的學習有所幫助。

聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

ASP.NET登錄注冊頁面實現(xiàn)

ASP.NET登錄注冊頁面實現(xiàn):如何利用Visual studio 2010創(chuàng)建一個ASP網(wǎng)站? 【文件】-->【新建】-->【網(wǎng)站】-->【ASP.Net網(wǎng)站】--【完成】 默認頁面Default.aspx 創(chuàng)建以上界面: <%@ Page Language=C# AutoEventWireup=true C
推薦度:
標簽: 注冊 登錄 用戶
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 浮梁县| 百色市| 南部县| 鹤庆县| 高平市| 东明县| 祁东县| 葫芦岛市| 大方县| 区。| 鸡泽县| 石景山区| 汉中市| 罗平县| 乌什县| 汽车| 海原县| 璧山县| 尼玛县| 廉江市| 厦门市| 手游| 松滋市| 龙游县| 锦州市| 米脂县| 凯里市| 饶阳县| 新晃| 双流县| 海兴县| 清丰县| 黄骅市| 江口县| 金湖县| 名山县| 临清市| 福安市| 汽车| 义马市| 老河口市|