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 –
請顯示你已有的代碼不工作 –