自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

ASP.NET數(shù)據(jù)庫連接實例淺析

開發(fā) 后端
ASP.NET數(shù)據(jù)庫連接是如何實現(xiàn)的呢?那么本文就將向你介紹ASP.NET數(shù)據(jù)庫連接的實例實現(xiàn),希望對你有所幫助。

ASP.NET數(shù)據(jù)庫連接實例展現(xiàn):

  1.  
  2. using System;   
  3. using System.Collections;   
  4. using System.ComponentModel;   
  5. using System.Data;   
  6. using System.Drawing;   
  7. using System.Web;   
  8. using System.Web.SessionState;   
  9. using System.Web.UI;   
  10. using System.Web.UI.WebControls;   
  11. using System.Web.UI.HTMLControls;   
  12. using System.Data.SqlClient;   
  13.  
  14. namespace Example01   
  15. {   
  16. ///   
  17. /// WebForm1 的摘要說明。   
  18. ///   
  19. public class WebForm1 : System.Web.UI.Page   
  20. {   
  21. private void Page_Load(object sender, System.EventArgs e)   
  22. {   
  23. // 在此處放置用戶代碼以初始化頁面   
  24. Response.Write("   
  25.  
  26. ***個ASP.NET數(shù)據(jù)庫連接的實例   
  27.  
  28. ");   
  29. SqlConnection myConnection = new SqlConnection("server=localhost;uid=sa;pwd=sa");   
  30. try   
  31. {   
  32. myConnection.Open();//打開數(shù)據(jù)庫鏈接   
  33. Response.Write("鏈接成功!");   
  34. }   
  35. catch   
  36. {   
  37. Response.Write("鏈接失??!");   
  38. }   
  39.  
  40.  
  41. #region Web 窗體設計器生成的代碼   
  42. override protected void OnInit(EventArgs e)   
  43. {   
  44. //   
  45. // CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設計器所必需的。   
  46. //   
  47. InitializeComponent();   
  48. base.OnInit(e);   
  49. }   
  50.  
  51. ///   
  52. /// ASP.NET數(shù)據(jù)庫連接之設計器支持所需的方法 - 不要使用代碼編輯器修改   
  53. /// 此方法的內(nèi)容。   
  54. ///   
  55. private void InitializeComponent()   
  56. {   
  57. this.Load += new System.EventHandler(this.Page_Load);   
  58.  
  59. #endregion   
  60. }   

ASP.NET數(shù)據(jù)庫連接的實例就向你介紹到這里,希望對你有所幫助。

【編輯推薦】

  1. ASP.NET運行環(huán)境搭建淺析
  2. ASP.NET學習之ASP.NET概述
  3. ASP.NET優(yōu)點的十一方面淺析
  4. ASP.NET數(shù)據(jù)庫連接淺析
  5. ASP.NET數(shù)據(jù)庫連接在web應用程序中的配置淺析
責任編輯:仲衡 來源: 星光下載
相關推薦

2009-07-28 17:36:21

ASP.NET數(shù)據(jù)庫連

2009-07-31 09:57:47

ASP.NET數(shù)據(jù)庫緩

2009-07-29 09:33:14

ASP.NET數(shù)據(jù)庫連

2009-07-27 17:58:10

ASP.NET數(shù)據(jù)庫編

2009-08-05 15:40:49

ASP.NET連接數(shù)據(jù)

2010-05-25 08:49:33

連接MySQL

2009-07-29 15:55:48

ASP.NET Req

2009-08-05 09:38:28

SQL Server數(shù)

2009-07-31 17:07:40

ASP.NET數(shù)據(jù)庫連

2011-08-01 23:34:34

ASP.NETOracle

2009-07-28 17:49:44

ASP.NET數(shù)據(jù)庫連

2010-06-07 14:34:49

連接MySQL 數(shù)據(jù)庫

2011-07-12 14:37:47

ASP.NET鏈接字符串

2009-07-24 13:41:15

ASP.NET AJA

2009-08-05 18:36:12

ASP.NET Che

2009-08-21 17:11:15

ASP.NET異步回調(diào)

2009-08-03 18:35:51

ASP.NET數(shù)據(jù)緩存

2009-07-31 12:43:59

ASP.NET MVC

2009-08-05 15:50:13

ASP.NET優(yōu)點

2009-02-23 15:20:03

SQL Server數(shù)據(jù)庫ASP.NET
點贊
收藏

51CTO技術棧公眾號