VB自帶登陸對話方塊使用者名稱及密碼如何設定

2021-03-08 17:52:52 字數 1027 閱讀 5283

1樓:匿名使用者

private sub cmdlogin_click()

dim rs as new adodb.recordset '定義一個新的記錄集

dim sql as string '定義一個字串,用來寫sql語句

if txtusername.text = "" or txtpassword.text = "" then

msgbox "使用者名稱或密碼不能為空", , "提示"

exit sub

end if

sql = "select * from users where u_username='" & txtusername.text & "' and u_password='" & txtpassword.text & "'"

if dataopen = true then

set rs = execsql(sql)

if rs.eof = true then

msgbox "您輸入的賬號或密碼錯誤"

else

strusername = txtusername.text

userid = rs(0).value

strrole = rs(3).value

if strrole = "管理員" then '用srtrole的值來判斷登入的角色是管理還是普通使用者

msgbox "歡迎管理員"

else

msgbox "歡迎" + strusername

end if

frmmdimain.show '顯示主窗體

unload me '解除安裝本窗體

end if

else

msgbox "連線資料庫失敗"

end if

end sub

這是我寫的一段連線資料庫登入**,希望對你有幫助

2樓:匿名使用者

真不知你問什麼

要是很多賬號和密碼就用資料庫吧 別急 先學其他基礎的東西 不要自虐哦!!!

vb歡迎介面,用vb編寫登陸介面

private sub form1 load printf 歡迎使用xx作業系統 form2.visible falsetimer1.interval n 1000 n秒timer1.enable true end sub private sub timer1 timer timer1.enable...

幫忙做個很簡單的VB使用者名稱密碼登陸程式。內有詳細

private sub command1 click if text1.text 001 and text2.text 100 then 自己改姓名和學號 form2.show unload me else msgbox 使用者或密碼錯誤,請從新輸入 text1.text text2.text en...

系統自動登陸問題,系統自動登陸問題

xp系統自動登陸 好多時候,我們都想不需要輸入密碼而登陸xp,因為大多數個人電腦的使用者都只有一個帳戶,基本上沒有所謂保密的必要,所以有沒有方法讓xp或者其他作業系統那樣可以自動登陸,就想以前win98那樣呢,答案當然是肯定的!1.win 2000系統 開啟控制面板 使用者和密碼 把要使用本機,使用...