vb.net中的login登录(用户名/密码)怎样编码实现!

sanxia21 2006-09-04 04:50:40
我是刚接触vb.net,请问在vb.net中怎么样编码来实现用户名登录(asp页面已经完成了)!
...全文
813 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
sanxia21 2006-09-04
  • 打赏
  • 举报
回复
谢谢大家的支持,我明白了!谢谢!
Ring850215 2006-09-04
  • 打赏
  • 举报
回复
Public Function selectString(ByVal strSql As String) As String
Dim conn As SqlConnection
Dim comm As SqlCommand

Try
If strSql Is Nothing OrElse _
strSql.Trim.Equals("") Then

Return Nothing
End If


conn = New SqlConnection("") '此出写连接语句
conn.Open()

comm = New SqlCommand(strSql, conn)

Return comm.ExecuteScalar().ToString

Catch ex As Exception

Return Nothing
Finally
If Not conn Is Nothing Then
conn.Close()
End If


conn = Nothing
comm = Nothing
End Try
End Function

Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click
Dim strSql As String
Dim table As DataTable
Try
strSql = "select ShainPwd from tblShain where UserName =" _
& "'" & textboxUserName.Text & "'"
strSql &= "And PWD='" & textboxPWD.Text & "'"
strTemp = clssql.selectString(strSql)
If strTemp Is Nothing Then
'验证不通过
End If
If strTemp.Trim = textboxPWD.Text.Trim Then
'验证通过
End If
Catch ex As Exception
Finally
End Try
End Sub
sanxia21 2006-09-04
  • 打赏
  • 举报
回复
请各位给出源代码!刚接触vb.Net,高不定阿
sanxia21 2006-09-04
  • 打赏
  • 举报
回复
对啊,业务逻辑是这样的,但是具体的代码实现是怎么样的?
Ring850215 2006-09-04
  • 打赏
  • 举报
回复
我是把用户的信息都存在一个SQL SERVER表里,登录的时候根据用户名和密码进行检索,检索出来有数据的话就登录成功,反之则失败
sanxia21 2006-09-04
  • 打赏
  • 举报
回复
在vb的数据后台进行用户登录判断!
sbgakg 2006-09-04
  • 打赏
  • 举报
回复
登陆别的电脑?只要登陆就行?让程序执行net命令就可以呀
水如烟 2006-09-04
  • 打赏
  • 举报
回复
NET.ASP的话,已经有现成的,不是可以指定登录方式的吗?
不过我没用过.
水如烟 2006-09-04
  • 打赏
  • 举报
回复
以前在网上看过这方面的资料,就是以给定账号登录别的电脑的(不是本机),
是用API.出处我都忘了.
sbgakg 2006-09-04
  • 打赏
  • 举报
回复
你是写ASP.net还是VB程序中的登陆呀?
如果是后者可以是程序本身就固定了用户名和密码,也可以是放在某个文件中,当你提交时对经,对就开放使用,不对就不开放

如果是前者,也可以是固定在文件中,但通常都是连接数据库的,提交时就读取数据库中的内容来对比,明白?

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧