C#小白必看:《第17章節QQ管理系統》

來源:互聯網
上載者:User

標籤:

QQ使用者資訊管理系統

 

首先看:

 

01.首先進入進入到登入介面:

 

建立DengLu()登入方法,進行對使用者錄入的資料進行對比:

 

對比完後進行判斷:

進入Welcome()方法中進行編寫歡迎介面:

 

讓使用者輸入,對使用者輸入的資料進行選擇:

 

歡迎介面使用do-while迴圈,可重複查看

 

 

02.顯示使用者清單:

 

進入if選擇結構判斷判斷等級大小:


 

小提示:輸入完後記得關閉資料庫連接Colse();

 

 

03.更新使用者線上天數:

 

首先建立一個U()方法,來充當SQL語句的增,刪,改:

 

然後返回到Update()方法中進行更新天數:

U("update UserInfo set OnLineDay=‘" + sky + "‘ UserId=‘" + id + "‘");//更新天數

 

 

04.新增使用者:

 

首先輸入相關資訊:

 

然後進行修改如下代碼:

U(" insert into UserInfo (UserName, UserPwd, LevelId, Email, OnLineDay) values(‘" + name + "‘,‘" + pwd + "‘,‘" + Level + "‘,‘" + email + "‘,‘" + sek + "‘)");

 

 

05.更新使用者等級:

如下代碼:

 

Console.WriteLine("本次共更新使用者記錄數{0}", U("update UserInfo set LevelId=" + 1 + " where OnLineDay<5    update UserInfo set LevelId=" + 2 + " where OnLineDay>5 and OnLineDay<32     update UserInfo set LevelId=" + 3 + " where OnLineDay>32 and OnLineDay<320     update UserInfo set LevelId=" + 4 + " where OnLineDay>320"));

 

使用SQL語句進行更新update 表名 set 列名=’新值’ where條件

 

 

06.刪除使用者資訊:

 

首先是輸入語句和查詢語句:

 

進行if判斷:

 

利用while迴圈依次查看使用者資訊:

 

然後再進行判斷使用者等級:

 

 

 

OK!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

C#小白必看:《第17章節QQ管理系統》

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.