listener = New TcpListener(System.Net.IPAddress.Any, portconnect)
listener.Start()
client = listener.AcceptTcpClient
loginInfo = receivedata()
Dim array() As String
array = loginInfo.Split("|")
username = array(0)
pass = array(1)
信息客户端发送到服务器是logininfo。我将logininfo输入用户名和密码。从客户端到服务器vb.net获取实际字符串
Public Function authentication(ByVal user As String, ByVal pass As String) As Boolean
Dim authentica As Boolean = False
Dim con As New OleDbConnection
Try
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & " data source= " & Application.StartupPath & "\" & dataName
Dim myCommand As OleDbCommand = con.CreateCommand()
Dim sqlstr As String = ""
sqlstr = "Select password from tbusers where Username = " & "'" & user & "'"
myCommand.CommandText = sqlstr
con.Open()
Dim passw As String
passw = myCommand.ExecuteScalar()
con.Close()
If pass = passw Then
authentica = True
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Return authentica
End Function
问题是:If pass = passw Then authentica = True End If
百达返回false。 请帮忙
没有兄弟,我认为,当客户端发送数据时,数据被封装。调试,用户是用户名和newstr =“用户名”。布尔用户= newstr,它返回false –
请显示你已有的代码不工作 –