0
私は視覚的な基本的なログインページを作成しようとしました。しかし、問題はログインが常に失敗することです。私のプログラムは私のSQLデータベースに接続されていますが、パスワードとユーザ名は正しいですが、出力は常にログイン失敗です!!私はどこがうっかりか分からない。私のSQLベースのビジュアル基本単純ログインアプリケーションでは常にログインに失敗します
Imports System.Data.SqlClient
Public Class login
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim connection1 As New SqlConnection With {.ConnectionString = "Server = VAIOO-PC ; Database = forum ; Integrated Security= true "}
Dim sqlcommand As New SqlCommand(" Select * from username where username= @username and password [email protected]", connection1)
sqlcommand.Parameters.Add("@username", SqlDbType.VarChar).Value = textboxuser.Text
sqlcommand.Parameters.Add("@password", SqlDbType.VarChar).Value = textboxpassword.Text
Dim sqldtaadpt As New SqlDataAdapter(sqlcommand) 'passes the command to via the adapter
Dim table As New DataTable()
If table.Rows.Count() <= 0 Then
MsgBox("USERNAME or THE PASSWORD IS INCORRECT")
Else
MsgBox("login successful")
End If
End Sub
End Class