フィールドが空白であるかどうかを確認した後に問題が発生します。私はプログラムを停止したいと思っています。今は進んでいて、フィールドが空白であっても、間違ったユーザー名パスワードを印刷私は、関数から次に知識vb.netのテキストボックスでの複数の検証
Private Sub ButtonOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOk.Click
Try
Dim con As New SqlConnection("Initial Catalog=stock;Data source=.;integrated security=true")
Dim ds1 As New DataSet
Dim da1 As New SqlDataAdapter("select * from login where Name='" & Trim(txtusername.Text) & "'and password='" & Trim(txtpassword.Text) & "'", con)
If txtpassword.Text.Length = 0 Then
MsgBox("Password or username feild left blank")
End If
If da1.Fill(ds1) Then
adminmain.Show()
Me.Close()
Else
MsgBox("Invalid Password or Username")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
これはウェブアプリですか、デスクトップアプリですか? ASP.Net? WinForms? WPF? – DOK
@ user1182892:StackOverflowへようこそ!最も役立つ答えを受け入れる必要があります(その隣のチェックマークをクリックしてください)。また、あなたを助けた他の回答をupvoteすることもできます。 –