Imports System.Data.SqlServerCe
Public Class frmLogIn
Dim con As SqlCeConnection = New SqlCeConnection("Data Source=|DataDirectory|\Library Full.accdb")
Dim Clear As Double
Dim myDA As SqlCeDataAdapter
Dim myDataSet As DataSet
Dim dt As New DataTable()
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
con.Open()
Try
Dim cmd As SqlCeDataAdapter = New SqlCeDataAdapter("SELECT firstName,Password FROM Members WHERE Username ='" & txtUserID.Text & "' AND Password ='" & txtPassLogIN.Text & "'", con)
cmd.Fill(dt)
If dt.Rows.Count = 0 Then
MessageBox.Show("Login failed, please try again.")
cmd = Nothing
dt.Clear()
ElseIf dt.Rows.Count = 1 Then
MessageBox.Show("Login worked...")
cmd = Nothing
dt.Clear()
End If
Catch ex As Exception
End Try
If con.State <> ConnectionState.Closed Then
con.Close()
End If
End Sub