vb.net网络登陆页面 vb登录页面

如何用VB.net连接数据库做一个简单的登陆窗口?Label1.Caption = "融通系统外挂程序"
If Dir(App.Path"/hjw.mdb")"" Then
Set mydata = https://www.04ip.com/post/OpenDatabase(App.Path"\hjw")
Set myrs1 = mydata.OpenRecordset("user", dbOpenTable)
Else
Set mydata = https://www.04ip.com/post/CreateDatabase(App.Path"\hjw", dbLangGeneral, dbVersion40)
mydata.Execute "create table ku (建立日期 text(100),库名 text(100),功能 text(100))"
mydata.Execute "create table system (店号 integer,建立日期 text(100),文件路径 text(100),软件版本 text(100),路径1 text(50),路径2 text(50),路径3 text(50),路径4 text(50))"
kuname = "system"
kugn = "文件信息"
Me.showlist1
mydata.Execute "create table user (user text(50),passwd text(50),name text(50),quanx integer)"
kuname = "user"
kugn = "用户信息"
Me.showlist1
Private Sub cmdOK_Click()
txtUserName.SetFocus
【vb.net网络登陆页面 vb登录页面】If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnlyvbExclamation, "警告"
txtUserName.SetFocus
Else
sql = "select * from user where user = '"txtUserName.Text"'"
'Debug.Print sql
'Set mrc = ExecuteSQL(sql, MsgText)
Set myrs2 = mydata.OpenRecordset(sql)
If myrs2.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnlyvbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(myrs2.Fields(1)) = Trim(txtPassword.Text) Then
UserName = myrs2.Fields(2)
myrs2.Close
Me.Hide
'UserName = Trim(txtUserName.Text)
'Debug.Print UserName
MDIform1.Show
Else
MsgBox "输入密码不正确 , 请重新输入!", vbOKOnlyvbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
End Sub
VB.net做登陆界面这个网站有链接数据库的方法,判断登录信息就是传入的sql语句是取出密码字段和用户名字段 , 分别和textbox1的值和textbox2的值判断
asp.net (vb)编写登陆页面(100分)system.data.sqlclient,而access则是引用的system.data.oledb
sub qd1(sender as object,e as eventargs)
dim user,pas as string
user = xm.text
pas = mm.text
dim myconn as string
myconn = "provider=microsoft.jet.oledb.4.0;""data source=" server.mappath("data/fang.mdb")
dim xm1,zw,qx as string
'检查用户名是否为空
if xm.text"" then
try
dim mysql as string
mysql="select * from 管理 where 用户名='" user "' and 密码='" mm "'"
dim mycmd as oledbdataadapter = new oledbdataadapter(mysql,myconn)
dim ds as dataset = new dataset()
mycmd.fill(ds,"管理")
dim mytable1 as datatable
mytable1=ds.tables("管理")
if user=mytable1.rows(0).item(1) and pas=mytable1.rows(0).item(3) then
xm.text=""
else
message.text="请重新输入!"
end if
catch ex as exception
message.text="用户名或密码有问题,请确认后重新输入!"
end try
else
message.text="用户名或密码有问题,请确认后重新输入!"
end if
end sub
下面是注册用的,可以同时检查是否有重名 。
dim myconn as oledbconnection
dim mycmd,mycmd1,mycmd2,mycmd3 as oledbcommand
dim strcon as string
dim strsql,strsql1,strsql2 as string
strcon ="provider=microsoft.jet.oledb.4.0;""data source="server.mappath("data/fang.mdb")
myconn = new oledbconnection(strcon)
myconn.open()
strsql = "select * from 管理 where 管理.用户名='" m_1 "'"
mycmd = new oledbcommand(strsql,myconn)
dim reader as oledbdatareader
reader = mycmd.executereader()
if reader.read() then '若存在
message.text="您输入的用户名已存在,请重新输入!"
reader.close()
myconn.close()
else '不存在,写入数据库
reader.close()
if m_4="管理员" then
strsql1="insert into 管理() values()"
mycmd1 = new oledbcommand(strsql1,myconn)
mycmd1.executenonquery
myconn.close()
message.text="您已成功注册!"
else
strsql2="insert into 管理() values()"
mycmd2 = new oledbcommand(strsql2,myconn)
mycmd2.executenonquery
myconn.close()
message.text="您已成功注册!"
end if
end if
else
message.text = "请检查页面中是否有错误!"
end if
end if
end sub
关于vb.net网络登陆页面和vb登录页面的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读