VB6 and ASP 製作管理系統1–製作添加使用者(3)

來源:互聯網
上載者:User
 

上次說到,登入之後,卸載登入視窗,然後顯示管理介面;

介面隨便設計吧.

表單圖如下,隨便畫的,有點亂。將就看吧,能知道用什麼控制項就行了!

只需要在Command1按鈕處添加代碼即可: 

添加使用者,用到 兩個Text控制項,一個Command控制項。

Text控制項分別命名為:txtUser,txtPass

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

雙擊Command1 添加如下代碼:

呵呵,習慣了ASP的寫法,

也可以直接用:conn.Execute("inst語句直接插入")

 

 1 Private Sub Command1_Click()
 2     '添加使用者
 3     Dim tuser
 4     Dim tpass
 5     tuser = Trim$(txtUser.Text)
 6     tpass = Trim$(txtPass.Text)
 7     
 8     If tuser = "" Then
 9         MsgBox "使用者名稱不可為空白"
10         txtUser.SetFocus
11         Exit Sub
12     End If
13     If tpass = "" Then
14         MsgBox "密碼不可為空白"
15         txtPass.SetFocus
16         Exit Sub
17     End If
18 
19     '開啟資料庫連接
20     Call OpenConn
21     sql = "select * from vuinfo"
22     rs.Open sql, conn, 1, 3
23     rs.AddNew
24     rs.Fields("username") = tuser
25     rs.Fields("password") = tpass
26     rs.Fields("userPower") = 0
27     rs.Update
28     '關閉資料庫連接
29     Call CloseConn
30     
31     MsgBox "添加使用者成功"
32     txtUser.Text = ""
33     txtPass.Text = ""
34     txtUser.SetFocus
35 End Sub

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.