亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ASP.NET實現(xiàn)圖書管理系統(tǒng)的步驟詳解

 更新時間:2020年06月16日 22:07:37   作者:Skrr.  
這篇文章主要介紹了ASP.NET圖書管理系統(tǒng)簡單實現(xiàn)步驟,本文通過實例截圖展示的形式給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下

一、數(shù)據(jù)庫添加

1.用戶信息

用戶信息表

2.圖書信息表

圖書信息表

3.圖書借閱信息表

圖書借閱表

二、版本頁面

vs2010+sqlserver2008

頁面 數(shù)據(jù)庫

三、實現(xiàn)功能

1. 用戶注冊登錄
2. 兩種身份:管理員和讀者
3. 讀者能夠注冊自己的賬號和密碼還有填寫自己的個人信息
4. 讀者根據(jù)自己需求的借閱和歸還圖書5. 管理員可以增、減、查、改等圖書信息,修改用戶信息待完善

四、主要頁面展示

1.登錄頁面 用戶登錄頁面2.用戶注冊 用戶注冊頁面3.個人信息表 個人信息表4.用戶歸還圖書

用戶歸還書籍5.用戶借閱書籍 用戶借閱書籍6.用戶檢索書籍 用戶檢索書籍 7.管理員頁面 管理員頁面

五、簡單代碼

1.注冊頁面(內(nèi)容判斷不在內(nèi))

try
 {
  //賦予sql字符串?dāng)?shù)據(jù)
  string strsql1 = "insert into yhxx (zh,mima) values ('" + Tet_zh.Text + "','" + Tet_mima.Text + "')";
  //創(chuàng)建字符串對象
  mycom = new SqlCommand(strsql1, myconn);
  mycom.ExecuteNonQuery();
  //關(guān)閉數(shù)據(jù)庫
  myconn.Close();
  Response.Write("<script>alert('添加成功??!')</script>");
  //保存賬號
  //str = Tet_zh.Text;
  //保存用戶名
  Application["name"] = Tet_zh.Text;
  //如果成功了成功轉(zhuǎn)入
  Response.Redirect("Useradd.aspx");
 }
 catch (Exception ex)
 {
  Response.Write("<script>alert('用戶已存在??!')</script>");
 }

2.個人信息頁面(內(nèi)容判斷不在內(nèi))

protected void tianjia()
 {
 //添加用戶信息
 try
 {
  //賦予sql字符串?dāng)?shù)據(jù)
  
  string strsql1 = "update yhxx set xm='"+Tet_xm.Text+"',xb='"+tet_xb.Text+"',qq='"+Tet_qq.Text+"',Email='"+Tet_email.Text+"',dizhi='"+tet_home.Text+"',enjioy='"+Tet_enjoy.Text+"' where zh='"+Application["name"]+"'";
  // 創(chuàng)建字符串對象
  mycom = new SqlCommand(strsql1, myconn);
  mycom.ExecuteNonQuery();
  //關(guān)閉數(shù)據(jù)庫
  myconn.Close();
  Response.Write("<script>alert('添加成功??!')</script>");
  Response.Redirect("denglu.aspx");
 }
 catch (Exception ex)
 {
  Response.Write("<script>alert('添加失?。?!')</script>"+ex.Message.ToString());
 }
 }

3.登錄頁面(內(nèi)容判斷不在內(nèi))

 //普通用戶登錄,管理員登錄雷同
 try
 {
  string sql = "select * from yhxx where zh='"+Tet_zh.Text+"' and mima='"+Tet_mm.Text+"' and yhlb='"+tet_dz.Text+"'";
  //創(chuàng)建命令對象
  SqlCommand com = new SqlCommand(sql,myconn);
  //創(chuàng)建讀取對象
  SqlDataReader dr = com.ExecuteReader();
  //成功彈出提示框
  //MessageBox.Show("讀取成功??!");
  if (dr.Read())
  {
  dr.Close();
  myconn.Close();
  Application["name1"] = Tet_zh.Text;
  Response.Redirect("index.aspx");
  }
  else
  {
  Response.Write("<script>alert('用戶名或密碼有誤?。?)</script>");
  }

 }
 catch (Exception ex)
 {
  Response.Write("<script>alert('登錄失?。?!')</script>");
 }

4.圖書檢索

try
 {
  //打開數(shù)據(jù)庫
  myconn.Open();
 }
 catch (Exception ex)
 {
  Response.Write("<script>alert('數(shù)據(jù)庫打開失敗')</script>");
 }
 try
 {
  //創(chuàng)建數(shù)據(jù)字符串
  if (tet_name.Text == "")
  {
  Response.Write("<script>alert('名稱不能為空!')</script>");
  }
  else
  {
  string strsql3 = "select BookID as 圖書編號,BookName as 圖書名稱,"
    + "Booklb as 圖書類別,Bookzz as 圖書作者,Booklr as 圖書內(nèi)容,"
    + "Bookfm as 圖書封面,Bookjg as 圖書價格,Bookzt as 圖書借閱狀態(tài) "
    + " from Bookxx where BookName='" + tet_name.Text + "'";
  mycom = new SqlCommand(strsql3, myconn);
  //打開數(shù)據(jù)庫
  //myconn.Open();
  //
  myread = mycom.ExecuteReader();
  GridView1.DataSource = myread;
  GridView1.DataBind();
  GridView1.Visible = true;
  //關(guān)閉數(shù)據(jù)
  myread.Close();
  myconn.Close();
  }
 }
 catch (Exception ex)
 {
  Response.Write("<script>alert('查詢失?。?)</script>" + ex.Message.ToString());
 }

5.圖書借閱

1.先添加圖書
 if (myread.Read())
 {
  if (tet_zt.Text == "0")
  {
  //添加借閱信息表
  myread.Close();
  string strsql5 = "insert into Bookjyxx (ISBookID,ISBookname,ISBookzt,ISname,ISid) " +
  " values (" + Tet_Bookid.Text + ",'" + tet_Name.Text + "'," + tet_zt.Text + ",'" + Tet_xm.Text + "'," + Tet_ID.Text + ")";
  mycom = new SqlCommand(strsql5, myconn);
  mycom.ExecuteNonQuery();
  //關(guān)閉
  myconn.Close();
  myread.Close();
 //////////////////////////////////////
  xiugai();
  chaxun();
  }
  if (tet_zt.Text == "1")
  {
  Response.Write("<script>alert('該書正在借閱中')</script>");
  chaxun();
  }
 2.再分別修改借閱狀態(tài)
  //創(chuàng)建
 //先修改圖書表狀態(tài)信息
 string strsql7 = "update Bookxx set Bookzt='1' where BookID='" + Tet_Bookid.Text + "'";
 mycom = new SqlCommand(strsql7, myconn);
 myconn.Close();
 myconn.Open();
 mycom.ExecuteNonQuery();
 //再修改借閱狀態(tài)表信息
 string strsql8 = "update Bookjyxx set ISBookzt='1' where ISBookID='" + Tet_Bookid.Text + "'";
 mycom = new SqlCommand(strsql8, myconn);
 mycom.ExecuteNonQuery();
 Response.Write("<script>alert('借閱成功!')</script>");
 //關(guān)閉
 myconn.Close();

6.圖書歸還

//刪除他的借閱圖書信息
 string strsql3="delete from bookjyxx where ISid='"+Tet_id.Text+"'";
 mycom = new SqlCommand(strsql3, myconn);
 myconn.Open();
 mycom.ExecuteNonQuery();
 //////////////////////////////
 //刷新信息
 //查詢信息
 string strsql4= "select ISname as 借閱者,ISid as 借閱證號碼,ISBookID as 借閱書籍編號,"
  + "ISBookname as 借閱數(shù)據(jù)名稱,ISBookzt as 借閱狀態(tài),ISdate as借閱日期 from Bookjyxx where ISid='" + Tet_id.Text + "'";
 mydata = new SqlDataAdapter(strsql4, myconn);
 DataSet set = new DataSet();
 mydata.Fill(set);
 GridView1.DataSource = set.Tables[0];
 GridView1.DataBind();
 GridView1.Visible = true;
 //修改狀態(tài)
 //先修改圖書表狀態(tài)信息
 string strsql7 = "update Bookxx set Bookzt='0' where BookID='" +tet_Bookid.Text+ "'";
 mycom = new SqlCommand(strsql7, myconn);
 mycom.ExecuteNonQuery();
 Response.Write("<script>alert('歸還成功!')</script>");
 //關(guān)閉
 myconn.Close();
 set.Clear();

總結(jié)

以上所述是小編給大家介紹的ASP.NET實現(xiàn)圖書管理系統(tǒng)的步驟,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

最新評論